• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to change the alignment of buttons in a toolbar

 
Greenhorn
Posts: 15
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!

I've been searching for an answer a long time now. Some other issues I had I got solved
simply by using the search in this forum ;)

Ok, I have got a toolbar in my GUI and when I drag it out of the window and let it snap
back again, the alignment of the buttons should change. That means when the toolbar
is in the north(I am using border layout), the buttons should go from left to right, when it is
in the east, they should go from up to down.
Is there maybe some kind of event I can listen to so I can change the alignment
manually?

Thank you for your help!
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The alignment changes for me. Maybe its a LAF issue?

Post your SSCCE that demonstrates the problem.
 
Tina Boettger
Greenhorn
Posts: 15
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll go and prepare some code...
Oh...
Maybe it is because I am using text on the buttons instead of icons?

If I take the ToolBar Demo from Oracle and don't add the gif-Files, the
problem occurs.

edit added the wrong Demo
http://download.oracle.com/javase/tutorial/uiswing/examples/components/index.html#ToolBarDemo

edit 2:
As I started off with the Demo as a base for my own toolbar, I thought the problem
occured right at the beginning but I was wrong It is working even without the icons...
Sorry for the misinformation...
 
Tina Boettger
Greenhorn
Posts: 15
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the toolbar:
Works correctly if I just add the Toolbar to a frame with no Layout...



But I have to add it this way:

changing the line where I add the toolbar to the Panel with different Layouts didn't work...
 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't change the layout of the toolbar.
 
Tina Boettger
Greenhorn
Posts: 15
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow that was magic
Thanks for the really fast help!

I have one other little question...should I open a new thread for it?
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it's not related to this problem then yes.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic