This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Can you have buttons on different ends of a jtoolbar? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Can you have buttons on different ends of a jtoolbar?" Watch "Can you have buttons on different ends of a jtoolbar?" New topic
Author

Can you have buttons on different ends of a jtoolbar?

Jason Richard
Ranch Hand

Joined: Oct 05, 2007
Posts: 69
Hi All,

I'd like to have my JToolBar have most of iit's buttons left Justified, but have one or two buttons be all the way on the right side so it would look something like

BBBB--------------------------------------BB

is there a way to do this without having two seperate JToolBars?

My current thought for a solution was to put two differnt JToolBars onto a split pane, and justify the split pane to be like .8 towards the right, but this doesn't seem as awesome as doing it on one JToolBar
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4530
    
    5

What happens when the toolbar is undocked and then docked on a vertical edge?

edit You could try adding a Box.createGlue() where you want the gap between buttons. Let us know how that works out.


luck, db
There are no new questions, but there may be new answers.
Jason Richard
Ranch Hand

Joined: Oct 05, 2007
Posts: 69
Darryl Burke wrote:What happens when the toolbar is undocked and then docked on a vertical edge?

edit You could try adding a Box.createGlue() where you want the gap between buttons. Let us know how that works out.


you mean like this?



that only worked PERFECTLY. IT goes away once you Un-dock (and comes back when you re-dock), but I might remove the un-docking all together (it's sort of a in the middle toolbar).

But that was great, I'm not sure why I didn't think of the GLUE. Well, probably because I've only been really doing this for about a month now.
 
 
subject: Can you have buttons on different ends of a jtoolbar?