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 / GUI / July 2007

Tip: Looking for answers? Try searching our database.

to make text compact on JButton

Thread view: 
Ray Ma - 18 Jul 2007 18:39 GMT
Hi,

I hope to make the text on the JButton compact. This is comparable to
set the "internal margin" attribute for a Text box in the Microsoft
WORD. The default margin is none zero. If you set one of the left/
right/top/bottom to be zero, a little more text can be displayed in
one line/column when the Text box size is not changed.

I didn't find where can I set this for the JButton. The JTextComponent
has a "setMargin(Insets m) " method to achieve this. But JButton is
not a subclass of JTextComponent. JButton has setFont() method, but
font attribute doesn't seem to deal with the text line margin. Font
class itself has "getLineMetrics()". I guess it's related but there's
no "setLineMetrics" so that I can set the internal text margin.

Currently, my Button has to be certain large to display its default
font-size (12, Times new roman) text. If I shrink the button, text
will be "..." but the total button size is actually enough to display
the text, if I can set the line' left and right margin =0; Besides, I
must use "center" alignment for the text.

Anyone has idea?

Thanks
Lew - 18 Jul 2007 21:11 GMT
> Hi,
>
[quoted text clipped - 18 lines]
>
> Anyone has idea?

See Knute Johnson's post on this question the first time it went up.

Signature

Lew

Ray Ma - 19 Jul 2007 21:40 GMT
> See Knute Johnson's post on this question the first time it went up.
>
> --
> Lew

Sorry my browser somehow doesn't refresh so I duplicate post.


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



©2008 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.