Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #2585

Re: Unpredictable Swing b

From "Nigel Wade" <nigel.wade@THRWHITE.remove-dii-this>
Subject Re: Unpredictable Swing b
Message-ID <fe0ec6$loq$1@south.jnrs.ja.net> (permalink)
Newsgroups comp.lang.java.gui
References <4703B048.2C8B@softhome.net>
Date 2011-04-27 15:39 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
Hokan Lane wrote:

> I have built an application based on JFrame and a BorderLayout with
> some added components. I have some very real problems with controlling
> how it behaves. Components are not necessarily shown until I resize the
> window. How do I solve that? I assume that it is some basic Swing
> methodology that I don't know. You may run the application from
> http://cafka.econ.au.dk/launcher.jnlp . Thanks in advance.
> 
> H|Nkan Lane

The usual reason for this is not following the rules on concurrency in Swing.
All modifications to the GUI should be performed on the event dispatch thread
(EDT). If you don't follow this rule then the EDT (which is responsible for
maintaining the view of the GUI) doesn't know that you've changed some aspect
of it and that it needs to be redrawn (gross oversimplification on my part).

Have a look at the Java Tutorial on Swing,
http://java.sun.com/docs/books/tutorial/uiswing/index.html,
especially the section on Concurrency in Swing.

-- 
Nigel Wade, System Administrator, Space Plasma Physics Group,
            University of Leicester, Leicester, LE1 7RH, UK 
E-mail :    nmw@ion.le.ac.uk 
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Unpredictable Swing behav "Håkan Lane" <håkan.lane@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000
  Re: Unpredictable Swing b "Ian Wilson" <ian.wilson@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000
  Re: Unpredictable Swing b "Nigel Wade" <nigel.wade@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000
  Re: Unpredictable Swing b "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
  Re: Unpredictable Swing b "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
    Re: Unpredictable Swing b "Håkan Lane" <håkan.lane@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
      Re: Unpredictable Swing b "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
        Re: Unpredictable Swing b "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
          Re: Unpredictable Swing b "Håkan Lane" <håkan.lane@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
            Re: Unpredictable Swing b "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
              Re: Unpredictable Swing b "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000

csiph-web