File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes two panels with cardlayout and jtoolbar always over both panels Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "two panels with cardlayout and jtoolbar always over both panels" Watch "two panels with cardlayout and jtoolbar always over both panels" New topic
Author

two panels with cardlayout and jtoolbar always over both panels

sureshksks ks
Greenhorn

Joined: Nov 16, 2012
Posts: 6
I am wriing a program in java using netbeans in which two panels in cardlayout over which a toolbar always over both these panels. I can use the same buttons in the toolbar for controlliong both panels. In other words If I swich to other panel i could see the same toolbar at the same place and use the same components in the toolbar. I could not find a solution . Please help. If there any other way please also explain.

Thanks in advance

suresh
sureshksks ks
Greenhorn

Joined: Nov 16, 2012
Posts: 6
HI Everybody...
I am not getting any replies ....have I asked something which is not answerable...


suresh
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 960
    
  10

Take a look at the Javadoc for CardLayout.next(). Read carefully!
sureshksks ks
Greenhorn

Joined: Nov 16, 2012
Posts: 6
can anyone explain with an example
my problem is the toolbar must be displayed at top of all panels. but it couldnot be placed/displayed proerly

Please help.
sureshksks ks
Greenhorn

Joined: Nov 16, 2012
Posts: 6
can anyone explain with an example
my problem is the toolbar must be displayed at top of all panels. but it couldnot be placed/displayed proerly

I am searching a solution for this last three weeks

Please help.
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 960
    
  10

sureshksks ks wrote:can anyone explain with an example
my problem is the toolbar must be displayed at top of all panels. but it couldnot be placed/displayed proerly
.

I thought your problem was in switching between the two panels using just one button but it now seems more fundamental. I think you need to spend more time looking at layout managers - http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html .

You seem to need a JPanel with a BorderLayout that has two children. In the NORTH position you need to place the toolbar and in the CENTRE position you need to place a second Panel that has a CardLayout. Into this second panel you place your alternate panels. I suspect the first panel should be used as the content pane of your JFrame.
sureshksks ks
Greenhorn

Joined: Nov 16, 2012
Posts: 6
thanks richard

you lead me the right way

thanks again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: two panels with cardlayout and jtoolbar always over both panels
 
Similar Threads
Only repaints once
Reg focus events
Building a GUI with dynamically changeable "inner view" of different components.
Layouts, Panel & Frame
JLabel on top of JLabel