Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

buttons too wide

Thread view: 
David McDivitt - 09 May 2006 15:05 GMT
When buttons are created they are often too wide for the text. The problem
is worse as text becomes longer. I want the same margin between border and
text for all buttons. Using style to adjust this value doesn't help. It
seems the button width is computed incorrectly, or by the wrong factor, for
the number of characters and font. Help would be appreciated. Thanks

Signature

NewsGuy.Com 30Gb $9.95 Carry Forward and On Demand Bandwidth

Thomas Weidenfeller - 09 May 2006 15:29 GMT
> When buttons are created they are often too wide for the text. The problem
> is worse as text becomes longer. I want the same margin between border and
> text for all buttons. Using style to adjust this value doesn't help. It
> seems the button width is computed incorrectly, or by the wrong factor, for
> the number of characters and font. Help would be appreciated. Thanks

Use layout managers.

Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

Vova Reznik - 09 May 2006 16:17 GMT
> When buttons are created they are often too wide for the text. The problem
> is worse as text becomes longer. I want the same margin between border and
> text for all buttons. Using style to adjust this value doesn't help. It
> seems the button width is computed incorrectly, or by the wrong factor, for
> the number of characters and font. Help would be appreciated. Thanks

Default margin for button is

Button.margin
     javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14]

It is your choice how and when to modify:
1. At startup for all buttons (Using UIManager)
2. At object creation for specific button
David McDivitt - 09 May 2006 16:28 GMT
>From: Vova Reznik <address@mail.com>
>Date: Tue, 09 May 2006 15:17:05 GMT
[quoted text clipped - 14 lines]
>1. At startup for all buttons (Using UIManager)
>2. At object creation for specific button

I should have been more specific. The button is in client-side HTML, not an
applet. It is a java struts application. I will find an HTML group and post
the question there, too.

Signature

NewsGuy.Com 30Gb $9.95 Carry Forward and On Demand Bandwidth

David McDivitt - 09 May 2006 17:34 GMT
>From: David McDivitt <x12code-del@del-yahoo.com>
>Date: Tue, 09 May 2006 10:28:47 -0500
[quoted text clipped - 21 lines]
>applet. It is a java struts application. I will find an HTML group and post
>the question there, too.

I was able to resolve this using a label and style sheet with inset and
outset. The label computes width correctly. Buttons do not.

Signature

NewsGuy.Com 30Gb $9.95 Carry Forward and On Demand Bandwidth



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.