• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Tran Tuan Hung
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic