?
Solved

Returning to main panel.

Posted on 2006-05-22
7
Medium Priority
?
237 Views
Last Modified: 2010-03-31
Problem:

JFrame contains mainPanel with method A that creates onePanel to display a table containg data from a DB.

When I'm done I want to return to the mainPanel so I can select a new method to call a different panel.

When I'm done with onePanel how do I get back to the mainPanel?
0
Comment
Question by:mmouer
  • 3
  • 2
  • 2
7 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 16734331
Sounds like you'd be well of with a CardLayout

http://java.sun.com/docs/books/tutorial/uiswing/layout/card.html
0
 

Author Comment

by:mmouer
ID: 16734946
Why would a Card layout help?

I want each panel to be displayed as it is selected and then return to the main panel, which contains several buttons, for the next selection.
0
 
LVL 92

Expert Comment

by:objects
ID: 16738373
Perhaps use a JDialog that pops up to display your table
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mmouer
ID: 16741178
Am I going about this the wrong way?
In other languages I've used when you branch to another form you return to the next instruction when you've completed using that new form.
Java continues before you return from the new form.
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 1000 total points
ID: 16741233
It sounds as if you're not so much interested in displaying panels as displaying windows. If so, use a JOptionPaneor JDialog as has been mentioned, in modal (default) mode:

http://java.sun.com/docs/books/tutorial/uiswing/components/dialog.html

0
 
LVL 92

Accepted Solution

by:
objects earned 1000 total points
ID: 16746275
> Java continues before you return from the new form.

Thats right Swing is event driven.
If you want to do something once the form is finished then add a listener to your form that gets called at the required time.
eg. an ActionListener on form Ok button, or a WindowListener on the forms window.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16761113
:-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month15 days, 21 hours left to enroll

850 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