Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can you have buttons on different ends of a jtoolbar?

 
Jason Richard
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5148
11
Java Netbeans IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jason Richard
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic