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've seen a similar problem on PCs when (get this) they are using an NVIDIA card and its OpenGL settings have antialiasing set to 4 (2, 8, or 16 work fine). The connection between OpenGL settings and Swing is inscrutable, but the problem is 100% reproducible.

On Mac, I've seen a problem like this when resizing windows. After you resize, the window does not repaint. The hideous workaround is below:

In the class we surround all JFrames with:

    Timer refreshTimer;

in the constructor...

        if (System.getProperty("os.name").startsWith("Mac"))
        {
            refreshTimer = new Timer(1000, new ActionListener () {
                    public void actionPerformed(ActionEvent evt) {
                        forceRefresh();
                    }
                });
            refreshTimer.setRepeats(false);
        }

and add these methods:

    public void forceRefresh()
    {
	JPanel contentPane = (JPanel)this.getContentPane();
        contentPane.remove((Component)root);
        contentPane.add(BorderLayout.CENTER, (Component)root);
    }

    public void componentResized(ComponentEvent evt)
    {
        super.componentResized(evt);
        if (refreshTimer != null)
            refreshTimer.restart();
    }

The timer is there so that it does not constantly call forceRefresh as the user drags the size around. The extreme violence I do to the windows in forceRefresh is the minimum I could find that would actually get the thing to repaint.

-Joshua

On Sep 14, 2006, at 12:08 PM, 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.


Unfortunately, we cannot reproduce the problem on any of our test machines.
Our applications have behaved without problems for several years now, with
hundreds of users (about half on Windows, though). The last time we had a
similar problem was when we still had to use Java 1.3 on OS X 10.2 (many
drawing / repaint problems there).


Did anyone notice any similar problems recently? Any suggestions on how to
address this? In the past, problems with our app could often be traced to a
particular Apple update (Java, Quicktime, ...). I could not find anything
this time, though, except for one unanswered post here from August 6.


Any help and suggestions would be very welcome.

Peter

 _______________________________________________
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


_______________________________________________ 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: 
 >Swing app display problems (From: Peter Richterich <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.