This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to create 2 toolbar consecutive on a JFrame??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to create 2 toolbar consecutive on a JFrame???" Watch "How to create 2 toolbar consecutive on a JFrame???" New topic
Author

How to create 2 toolbar consecutive on a JFrame???

Tran Tuan Hung
Ranch Hand

Joined: Apr 08, 2007
Posts: 59
Hi all
I have a JFrame, i create 2 toolbars and i added them on a JFrame, but when i launch the application, the program only display toobar2 if i set layout for toobar2 is : BorderLayout.NORTH, because i would like display them consecutive
Here is my code:

thanks and best regards,
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Only one component can take up space in a layout constraint. What you need to do is create a Tool Bar JPanel that uses something like a Box layout Y_AXIS or a GridLayout, etc. Add your tool bars to that container, then add it to the frame's NORTH constraint.


GenRocket - Experts at Building Test Data
Tran Tuan Hung
Ranch Hand

Joined: Apr 08, 2007
Posts: 59
thanks a lot for your help, for now i would like to close JToolbar when i drop/drap it and click on "X" button?
very thanks.
best regards,
Sandeep Mukherji
Ranch Hand

Joined: Mar 23, 2008
Posts: 46
You said that:
"i would like to close JToolbar when i drop/drap it and click on "X" button?"
Can you please elaborate this a little more? Do you mean that you want a x button on the toolbars, so that you can close it?
Tran Tuan Hung
Ranch Hand

Joined: Apr 08, 2007
Posts: 59
No, i would like to close the toolbar when i click on the "X" in the upper right corner (not create a new button). But when i click on it then it return the default location. Sorry for my bad english. I have asked this quesion in some forum, but not get the answer. Hope here help me.
 
Consider Paul's rocket mass heater.
 
subject: How to create 2 toolbar consecutive on a JFrame???
 
Similar Threads
Accesing system clipboard in Applet
Adding a window to a container
Assigning a JPanel to a new JPanel obejct!
WhenI try to run this applet it gives an error??? why??need help!
problem in swing tool bar