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 / June 2005

Tip: Looking for answers? Try searching our database.

Gridbaglayout - settext resizing...

Thread view: 
Chris Flynn - 01 Jun 2005 10:46 GMT
Hi,
Newbie post - sorry! I can't see the answer around anywhere I don't think
(it's not in the FAQ!).
I'm using GridBagLayout in Java 1.5.

JButton ButtonA's text is originally set to "a very very very long piece of
text". If I then use an actionlistener to do ButtonA.setText("short"); then
ButtonA is resized to just fit "short", and thus changes the rest of my
grid. Is there any way to keep the original proportions, or have I chosen
the wrong layout manager? I'm assuming that my program will always be run
maximised, so I don't have to worry about the screen being resized TOO
much...

Also, I don't suppose there's a simple way to clear a JTextField on mouse
click other than implementing myText.setText(""); with an actionlistener?

Cheers,
Chris
Ben Kaufman - 08 Jun 2005 02:38 GMT
>Hi,
>Newbie post - sorry! I can't see the answer around anywhere I don't think
[quoted text clipped - 14 lines]
>Cheers,
>Chris

Try JTextField.setColums(int n)

Ben


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.