This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JFrame Help Please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFrame Help Please" Watch "JFrame Help Please" New topic
Author

JFrame Help Please

ben williamson
Greenhorn

Joined: Apr 08, 2008
Posts: 5
Hey all,

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.

Mank Thanks,

Ben
ben williamson
Greenhorn

Joined: Apr 08, 2008
Posts: 5
Hi,

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??

thansk
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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.


GenRocket - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JFrame Help Please