Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Changing the text alignment of a JButton

843805Jan 24 2006 — edited Jan 24 2006
I have a JButton to which i am just adding a text string. I have to align the text to the left of the button. I have gone through the API. There are constructors to align the text with respect to an icon but not for simple text. I tried the following code. It didn't work. Does anyone know?
    	linksButton = new JButton(link);    	
    	linksButton.setHorizontalTextPosition(SwingConstants.LEFT);
    	linksButton.setBounds(xComp,yComp,width,height);
I also tried using the setComponentOrientation method. It didn't work.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 21 2006
Added on Jan 24 2006
2 comments
790 views