Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Multiple JPanel in JApplet

Posted on 2007-11-21
2
Medium Priority
?
1,176 Views
Last Modified: 2013-11-23
This should be a simple task, but I don't do that much with Java.

5 different JPanel classes which handle their own actions have been created.  For this conversation we will call them MyPanel1 ... MyPanel 5.  The first of these is a button/keypad menu.  All of this must run within a JApplet.  When the user selects one of the buttons a new class instance is created of the appropriate class and becomes the content for the JApplet.  When the user wishes to exit that JPanel they chose an exit option and it finalizes.  The JApplet should redisplay the original menu JPanel class (MyPanel1 for this discussion).

Need to see a code snippet for the switching back and forth.

0
Comment
Question by:yyyc186
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 92

Expert Comment

by:objects
ID: 20331805
a CardLayout can be used for easily switching between panels
0
 
LVL 7

Accepted Solution

by:
UrosVidojevic earned 1000 total points
ID: 20331824
In my opinion, in this case it is the most appropriate to use CardLayout class, to realize that kind of panel switching.

You should have one main panel with 5 panels added to it using CardLayout. Initialy MyPanel1 instance will be visible. When user choose some button from MyPanel1, main panel will switch its content to appropriate panel. When user wants to return to MyPanel1, clicking the appropriate "exit" button will make MyPanel1 visible again.

Examples:
1.) http://www.science.uva.nl/ict/ossdocs/java/tutorial/ui/layout/card.html
2.) http://www.javareference.com/jrexamples/viewexample.jsp?id=28
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

671 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question