Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Restart a JFrame

843804Nov 25 2004 — edited Nov 26 2004
Hello!

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! :)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 24 2004
Added on Nov 25 2004
1 comment
381 views