Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to change the alignment of buttons in a toolbar

 
Tina Boettger
Greenhorn
Posts: 15
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • 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!
 
Rob Camick
Ranch Hand
Posts: 2703
10
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
Ranch Hand
Posts: 2703
10
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it's not related to this problem then yes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!