Possible Duplicate:
How can I restart a Java application?
i am working on a java program which takes in bunch of values from the user and returns an answer. i have a "clear" button which makes the application ready to for a new set of input. So what i want is that this button should close the frame currently being viewed(create a window closing event and so on) and then call the main() function to create a new instance of my application. How should i do it? I tried this but it closes everything and the new frame doesn't show up:
WindowEvent wev = new WindowEvent(this, WindowEvent.WINDOW_CLOSING);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(wev);
main(newInstance);
and also what does Toolkit do? suggest some readings for that. Thank you.