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 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 Murach's Java Servlets and JSP this week in the Servlets 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: 4523
    
    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?
 
Similar Threads
Loading and unloading a panel
Control scheme ?
Redraw of JSplitPane components not happening
Notification Question
JToolBar - setRollover and alignment