Link to home
Start Free TrialLog in
Avatar of hipal
hipalFlag for United States of America

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!
Avatar of incerc
incerc
Flag of Romania image

ASKER CERTIFIED SOLUTION
Avatar of Valeri
Valeri
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> How can I set the JButton length according to text displayed ?

With most  layout managers it does this automatically. Which one are you using?
Avatar of hipal

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
@Valeri
Sorry, i thought it did !!!