K
K
Kirill Romanenko2014-08-04 00:26:15
Java
Kirill Romanenko, 2014-08-04 00:26:15

How to assign a return code to the main menu on a button?

There is a small window that opens when you click on the button. In this window, you can read the information, then, by clicking on OK, you need to return back to the main menu. I wrote
final JButton exit = new JButton("OK");
exit.setSize(100, 30);
exit.setLocation(345, 530);
add(exit);
{
exit.addActionListener(new ActionListener()
{
public void actionPerformed(final ActionEvent e)
{
goto main.class;
}
});
}
It is clear that it does not work, but what should be written to the listener to return back?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan Lopatin, 2014-08-04
@lorus

You probably need to close the "small window" and then open the "main menu". How to open the menu - described here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question