This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes frame calling another frame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "frame calling another frame" Watch "frame calling another frame" New topic
Author

frame calling another frame

Benjamin Mulder
Greenhorn

Joined: Mar 13, 2004
Posts: 18
Background: : I have two frame/classes. A login screen and a "display results" screen. A login screen has a login button which takes you to display results screen.
Display eesults screen as a logout button however...

Problem: when you click on the logout button, it generates two instances of the login screen. In other words, two login screens appear one on top of the other on the left hand corner NOT in the center like the first time the program launches.

Behavior I want: once I click logout on "display results" screen, I go right away to the login screen. Exactly the way it previously was: centered and with only one instance running not two as it is right now.

This is on the login screen.


this is on the results screen



thanks in advance....
Aaron Roberts
Ranch Hand

Joined: Sep 10, 2002
Posts: 174
You only need one JFrame to do what you are doing.

You could use a CardLayout. Create two JPanels, a login one and a results one. Add them both to the CardLayout. When you press the login button, simply have the CardLayout show the other panel. Likewise, have the results page show the login panel.

You can simply update the content of the results panel before you show it.

Should work like a charm.

HTH,
Aaron R>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: frame calling another frame
 
Similar Threads
GUI'S
How is a Graphical object move on the Screen by using JButton.
Dynamic Swing
Errors in GUI program
Hide the Button When User Clicks On It