Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Swing app display problems



I can think of several things that could cause this. The most often I've seen this is when the event dispatching thread is being hogged. Are there active graphics, like an animation going on? If so, I would be willing to bet that someone has written alot, if not all the code that updates the screen within the whatever method is used to repaint the screen (paint() etc.). If this is the case move that code out of the method that updates the screen.

For example, here's some p-code for an EDT hog:

   void paint(Graphics g)
      {
      ....tons of code to create an image
      ...now just update the screen with something like g.drawImage()
      }

   public void run()
      {
      while (true)
        {
        repaint()
        .... do whatever else
        }
      }

Now here it is with the EDT unloaded:

   void paint(Graphics g)
      {
      ...now just update the screen with something like g.drawImage()
      }

    void newDrawingMethod()
      {
      ...tons of code that used to be in paint() now here
      }

public void run()
     {
     while(true)
        {
        newDrawingMethod();
        repaint();
        ....do whatever else
        }
      }

Another possibility could be that some task that's consuming a lot of time (like trying to access a database on a high traffic system) is also embedded directly or indirectly on the EDT, but the problem will really be the same. I believe most of Swing's stuff resides almost exclusively on the EDT but I'm not sure. Watch out for sleep() statements!!!

Hope this helps in some way,

Bill Wagner


Peter Richterich wrote:


We have a problem with Swing applications not displaying properly. Several users have reported totally or partially blank windows, and sent screen shots. This started happening about 2 weeks ago on G4s and dual G5s running Java 1.4.2_09 on 10.4.7.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Swing app display problems (From: Greg Guerin <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.