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

Tip: Looking for answers? Try searching our database.

Problems with setting the text in a JLabel

Thread view: 
James Aguilar - 14 Jan 2005 07:10 GMT
Hey all,

I have a gui that is set up using a GridBagLayout.  The content pane has
nine panels and a JLabel added to it.  Each of the nine panels has one
JList, two JButtons, and a JLabel, set up in border layout.

Here's the problem.  Everything works fine until I change the text of the
label.  Once I do that, the whole display becomes corrupted.  The JButtons
and JLabels disappear, and the JLists empty.  The whole display collapses to
a much smaller size in the center of the display.

In other forums, I have received advice about making sure that the changing
of the text is not in the main thread.  It isn't, and even when I put it in
another (new) thread, it did not work.  Any ideas?

James
Andrew Thompson - 14 Jan 2005 07:49 GMT
> I have a gui that is set up using a GridBagLayout.  The content pane has
> nine panels and a JLabel added to it.  Each of the nine panels has one
> JList, two JButtons, and a JLabel, set up in border layout.
>
> Here's the problem.  Everything works fine until I change the text of the
> label.  

Recent posts suggest that GBL reacts poorly when a component
cannot be assigned it's minimum size.  If you want to fix
this GBL, that is where I recommend looking.  OTOH, I more stringly
recommend that you dump GBL altogether and use another layout,
or a combination of layours.

HTH

Signature

Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane

The Grim Reaper - 16 Jan 2005 10:54 GMT
> > I have a gui that is set up using a GridBagLayout.  The content pane has
> > nine panels and a JLabel added to it.  Each of the nine panels has one
[quoted text clipped - 10 lines]
>
> HTH

I agree. I would recommend TableLayout instead of GBL.  It can be downloaded
from the sun web site:
http://java.sun.com/products/jfc/tsc/articles/tablelayout/ and is much more
straighforward to use.


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.