Solved

setting the JButton length according to text displayed

Posted on 2010-11-11
8
362 Views
Last Modified: 2012-05-10
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
Comment
Question by:hipal
8 Comments
 
LVL 4

Expert Comment

by:incerc
ID: 34112427
0
 
LVL 16

Accepted Solution

by:
Valeri earned 500 total points
ID: 34112650
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 34112835
>> 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
 

Author Comment

by:hipal
ID: 34113536
I am not using any layout manager .. in that cas e??
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Expert Comment

by:alpharom
ID: 34113709
try pack() , it will adjust it automatically no ??
0
 
LVL 16

Expert Comment

by:Valeri
ID: 34113710
read my link, it's exactly for buttons places in panel without  any layout manager...
0
 
LVL 16

Expert Comment

by:Valeri
ID: 34113725
@alpharom
JButton doesn't have pack method
0
 
LVL 3

Expert Comment

by:alpharom
ID: 34113739
@Valeri
Sorry, i thought it did !!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
diffSum example 4 20
egit plugin on eclipse 8 28
MySQL  on Tomcat 8 23
configure dependency in POM for new database 3 13
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn how to implement Singleton Design Pattern in Java.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now