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 JToolbar dilema ! 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 "JToolbar dilema !" Watch "JToolbar dilema !" New topic
Author

JToolbar dilema !

David Garratt
Ranch Hand

Joined: Aug 08, 2003
Posts: 196

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

Joined: Jun 09, 2003
Posts: 4632
(untested)

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

Joined: Aug 08, 2003
Posts: 196

Many thanks for your help.

Eventually I found a .setMaximumSize method which did the trick for me.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JToolbar dilema !
 
Similar Threads
Button alignment in a JToolbar
Dynamic Toolbar
Eclipse Ant Integration (or, I want a big Ant Button)
Adding 'Save All' button to Eclipse toolbar - How?
Adding a Button to JToolBar