wood burning stoves
The moose likes Swing / AWT / SWT and the fly likes JToolbar dilema ! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JToolbar dilema !" Watch "JToolbar dilema !" New topic

JToolbar dilema !

David Garratt
Ranch Hand

Joined: Aug 08, 2003
Posts: 212

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 !


Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632

add the combobox to a JPanel
add the panel to the toolbar
David Garratt
Ranch Hand

Joined: Aug 08, 2003
Posts: 212

Many thanks for your help.

Eventually I found a .setMaximumSize method which did the trick for me.
jQuery in Action, 3rd edition
subject: JToolbar dilema !
It's not a secret anymore!