Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing - switch to another pane  RSS feed

 
Rob Ko
Greenhorn
Posts: 8
Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey

just having a small problem ôo

I have two classes: main (with JFrame) and a panelLogin class with a method returning a panel with all login components

so I create a new panelLogin in main and use the method to get the panel, put it into my JFrame.

But here the problem: on the loginPanel the ActionListener for the login-event, if the input is correct,
the panel shall disappear and the main panel shall appear.

Should I make some kind of top class, which handels the panels?

Any Ideas for me so far? >.>

Greetings
Kaito
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a good use case for a CardLayout.
 
Rob Ko
Greenhorn
Posts: 8
Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tried it, works fine
thank you
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!