I have a problem with a Frame that I want to restart after an operation.
In specific, below the start of the Frame
:
public static void startHome() {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
frame = new HomeGUI();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
Below the Frame:
public HomeGUI() throws IOException, InstantiationException, IllegalAccessException {
setIconImage(Toolkit.getDefaultToolkit().getImage(ico_path));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 669, 516);
// etc...
Below my actual code for the restart, but doesn't work:
frame.dispose();
startHome();
Processing stops before to enter in run()
method.
I tried to set frame = null
before invokeLater
and after dispose()
, but doesn't work.
Thank you to all