File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

JToolbar dilema !

David Garratt
Ranch Hand

Joined: Aug 08, 2003
Posts: 187

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: 187

Many thanks for your help.

Eventually I found a .setMaximumSize method which did the trick for me.
 
Consider Paul's rocket mass heater.
 
subject: JToolbar dilema !
 
Similar Threads
Adding a Button to JToolBar
Eclipse Ant Integration (or, I want a big Ant Button)
Dynamic Toolbar
Button alignment in a JToolbar
Adding 'Save All' button to Eclipse toolbar - How?