Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding a Button to JToolBar  RSS feed

 
Chinmay Kant
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How can I add a Button to A ToolBar so that the Button comes on the Right hand side of the Toolbar, not on the Left Hand Side. Just Like the Close Maximize and Minimize Buttons for Windows Application

In other words, How can i add a Button so that it comes at the end of Toolbar
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setComponentOrientation(...)
 
Chinmay Kant
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Method setOrientation sets the Child Component from Right to left, not the Parent component.

What is my actual case is there is toolbar where there are tool buttons and to the end of this tool bar, i need to attach a Image. All Buttons are on the Left Side whereas the only Image is on RightSide.

Please Help me considering the scenario
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, there is an easy answer, but I won't bother in case you change the scenario again

[edit]
just in case this is the last scenario change, the answer is to draw
your image in the right hand border of the toolbar.

search the forum for craig wood's excellent example of drawing an image
in the border of a JTextField (process for toolbar is the same)
[ March 14, 2008: Message edited by: Michael Dunn ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!