This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Little advice on JPanels in JFrame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Little advice on JPanels in JFrame" Watch "Little advice on JPanels in JFrame" New topic
Author

Little advice on JPanels in JFrame

peter hammond
Ranch Hand

Joined: Apr 20, 2011
Posts: 41
hello javaRanchy's

i need a little pointer about JPanels and if that is even the best way to code...

I have a main GUI JFrame with:

menuBar -> JToolBar -> JPanel 1

what i want is create a seperate .java file for each new panel and then have update the main GUI when the selected panel is selected...

i.e

main.java
panel1.java
panel2.java
panel3.java

then in the main GUI

menuBar -> JToolBar -> JPanel 1
selected option in toolbar to show
menuBar -> JToolBar -> JPanel 2

hope that makes sence

i just want to have multiple JPanels ontop of each other then only set the one that is requested to be visable...

as a tabbed pane will have to many tabs and wont fit on the page...

any info will be a great help

many thanks
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

peter hammond wrote:i just want to have multiple JPanels ontop of each other then only set the one that is requested to be visable...


That's what CardLayout does.


luck, db
There are no new questions, but there may be new answers.
peter hammond
Ranch Hand

Joined: Apr 20, 2011
Posts: 41
cool thanks will give it a look wasnt sure what i needed to look at... ta
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Little advice on JPanels in JFrame
 
Similar Threads
Building a GUI with dynamically changeable "inner view" of different components.
JMenuBar not using default alignment?
JApplet
Serialization??
JFrame question.