hipal
asked on
setting the JButton length according to text displayed
How can I set the JButton length according to text displayed ?
Using setSize() I have to everytime adjust it according to want I want as text on button.
thanks!
Using setSize() I have to everytime adjust it according to want I want as text on button.
thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> How can I set the JButton length according to text displayed ?
With most layout managers it does this automatically. Which one are you using?
With most layout managers it does this automatically. Which one are you using?
ASKER
I am not using any layout manager .. in that cas e??
try pack() , it will adjust it automatically no ??
read my link, it's exactly for buttons places in panel without any layout manager...
@alpharom
JButton doesn't have pack method
JButton doesn't have pack method
@Valeri
Sorry, i thought it did !!!
Sorry, i thought it did !!!
Do you use a LayoutManager class?
Please take a look at this :
http://download.oracle.com/javase/1.4.2/docs/api/java/awt/FlowLayout.html
http://download.oracle.com/javase/tutorial/uiswing/layout/using.html