Basically i havn't programmed for quite a while now and am trying to get back into it, i am trying to make a little application with a JFrame, and here is the code I have produced...
Basically, I have created a little JFrame with some layout and 2 main buttons...and this is in a file called titleFrame.java....what I want to do though, is when the 'New' Button is pressed, i would like it to call another seperate class i have created, main.java....whereby in that java file it is like this one, but with different buttons and all....
I think this is really simple to achieve, i just simply cannot remmeber what to do, if anyone can help it would be superb! Also, when the 'Exit' button is pushed, what is the correct syntax to close the JFrame, I need to catch back up on this but im starting to get back into it.
Joined: Apr 08, 2008
I have managed to solve this, but i stil cannot get the first window to close then the second is created, anyone know how to do this??
You'll need to call frame.dispose() on the frame you want to make go away. That said, the better approach would be to simply swap out your JPanel with a new JPanel that contains all the components you want.