[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 375
  • Last Modified:

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!
0
hipal
Asked:
hipal
1 Solution
 
incercCommented:
0
 
CEHJCommented:
>> How can I set the JButton length according to text displayed ?

With most  layout managers it does this automatically. Which one are you using?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
hipalAuthor Commented:
I am not using any layout manager .. in that cas e??
0
 
alpharomCommented:
try pack() , it will adjust it automatically no ??
0
 
ValeriCommented:
read my link, it's exactly for buttons places in panel without  any layout manager...
0
 
ValeriCommented:
@alpharom
JButton doesn't have pack method
0
 
alpharomCommented:
@Valeri
Sorry, i thought it did !!!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now