Restart a JFrame
843804Nov 25 2004 — edited Nov 26 2004Hello!
I have an application that calls a JFrame - the JFrame does some ammount of things and then I need to restart it through a mouse event - so far I can simply use System.exit() on the MouseListener to exit the whole application when the user presses a button, but what I really need is to restart it (and I can't do it from the Frame's code, I've already tried it in another way). How can I do it? Here's the code of the class that calls the frame (the frame's name is Frame1):
public class teste3 {
boolean packFrame = false;
public teste3() {
Frame1 frame = new Frame1();
if (packFrame)
frame.pack();
else
frame.validate();
frame.setVisible(true);
}
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(Exception e) {
}
new teste3();
}
}
If it's impossible, how can I restart the whole application from within the frame?
Thanx in advance! :)