Answer the question
In order to leave comments, you need to log in
Sticky interface button or how to add a Swing function call to an event?
There is a code:
//Обработчик при нажатии на кнопки в окошке интерфейса
class ListenerAction_start implements ActionListener {
public void actionPerformed(ActionEvent e) {
System.out.println("\n" + "Вы выбрали -> ["+
e.getActionCommand() + "]" + "\n");
Start_main();
}
}
class ListenerAction_stop implements ActionListener {
public void actionPerformed(ActionEvent e) {
System.out.println("\n" + "Вы выбрали -> ["+
e.getActionCommand() + "]" + "\n");
}
}
// подключение монитора событий нажатия на кнопки интерфейса
button.addActionListener(new ListenerAction_start());
button2.addActionListener(new ListenerAction_stop());
Answer the question
In order to leave comments, you need to log in
Your main processing cycle is blocked. Use SwingYtilities. invokeLater() and wrap it in Runnable.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question