Solved

setting the JButton length according to text displayed

Posted on 2010-11-11
8
361 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.

758 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

24 Experts available now in Live!

Get 1:1 Help Now