Answer the question
In order to leave comments, you need to log in
How to organize the code correctly?
I am making a menu for the program and there are many similar places:
// ...
menuFile = new JMenu("Файл");
menuBar.add(menuFile);
itemCreate = new JMenuItem("Создать");
itemCreate.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// код
}
});
menuFile.add(itemCreate);
// ...
// ...
itemCreate = new JMenuItem("Создать");
itemCreate.addActionListener(e -> onCreate());
menuFile.add(itemCreate);
// ...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question