• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

frame calling another frame

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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....
 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic