Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JToolbar dilema !

 
David Garratt
Ranch Hand
Posts: 212
Eclipse IDE Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a toolbar in my application which is working just fine. It contains just buttons and separators. All of the buttons are left justified on the toolbar and they extend approx half way across the screen. I want to add a small JComboBox at the end of the buttons. However when I add this it always seems to stretch to fill the remaining width of the toolbar despite me setting both it's size and preferredsize. Any ideas on this one would be great - an example would be fabulous !

Thanks

Dave
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(untested)

add the combobox to a JPanel
add the panel to the toolbar
 
David Garratt
Ranch Hand
Posts: 212
Eclipse IDE Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks for your help.

Eventually I found a .setMaximumSize method which did the trick for me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic