Author |
Message |
UnusedUsername
|
Posted: Tue Jul 24, 2007 10:57 am Post subject: JButton Alignment |
|
|
I want to create JButtons with text positioned to their very left.
I've tried using setHorizontalAlignment(), setHorizontalTextPosition() and setMargins() but none of them can create the desired effect.
Does anyone know how to do this? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Aziz
![](http://compsci.ca/v3/uploads/user_avatars/17740604804829f8242e90c.png)
|
|
|
|
![](images/spacer.gif) |
UnusedUsername
|
Posted: Tue Jul 24, 2007 4:33 pm Post subject: RE:JButton Alignment |
|
|
After reading it, I don't think it can be done, which is rather odd. |
|
|
|
|
![](images/spacer.gif) |
rizzix
|
Posted: Tue Jul 24, 2007 4:42 pm Post subject: RE:JButton Alignment |
|
|
It is definitely possible.
code: | button.setHorizontalAlignment(SwingConstants.LEFT); |
To make it such that the text is positioned to the far left, you'd have to pass appropriate Insets to setMargin(); and reduce the gap to Zero. |
|
|
|
|
![](images/spacer.gif) |
UnusedUsername
|
Posted: Wed Jul 25, 2007 7:06 am Post subject: RE:JButton Alignment |
|
|
I see how it works now. I have to use setAlignment() in conjunction with setMargins(). Thanks for the help guys (or gals). |
|
|
|
|
![](images/spacer.gif) |
Aziz
![](http://compsci.ca/v3/uploads/user_avatars/17740604804829f8242e90c.png)
|
Posted: Wed Jul 25, 2007 8:42 am Post subject: RE:JButton Alignment |
|
|
Guys. Definitely guys. Unless you're hiding something, rizzix? Anyways, glad we could help. Java Tutorials + API documentation (and the occasional google) is one of a java programmer's best assets. |
|
|
|
|
![](images/spacer.gif) |
|