I "solved" this problem some time ago.

Following hacks helped me:
1. window.setBackground(UIManager.getColor("control"));          // of course after
setting the right L&F
2. to wait some time after adding all components, but before showing
     content.add(quitButton);
      try {
        Thread.sleep(100);
      }
      catch (InterruptedException e) {}
      win.show();

But in summary JWindow is one of the worser Swing components. There are also
problems with focus.

Radim

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Sean Sharp
Sent: Thursday, April 11, 2002 5:06 PM
To: Java Swing Mailing List
Subject: JWindow flicker problem


I am noticing a flickering problem when initially displaying a JWindow.
It always flashes white before displaying the correct background color.
In fact it appears to go white, bgcolor, white, and then bgcolor all in
a split second.  I tested on two different machines (P333 and a P2-400)
and both show the same flickering.

Is this a know problem or am I not doing something quite right?  I
searched the Java bug database, but could not find an entry regarding
this issue.  The code below creates a full screen JWindow which always
flickers on initialization.

-Sean


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class WindowTest implements ActionListener
{
    JWindow         win;
    Container       content;
    JButton         quitButton;

    public WindowTest()
    {
        win = new JWindow();
        content = win.getContentPane();
        content.setLayout(null);
        Dimension screenResolution = win.getToolkit().getScreenSize();
        win.setSize(screenResolution);
        content.setBackground(Color.darkGray);

        // Quit Button
        quitButton = new JButton("quit");
        quitButton.setSize(70,40);
        quitButton.setLocation(500, 500);
        quitButton.addActionListener(this);
        content.add(quitButton);

        win.show();
    }

    public void actionPerformed(ActionEvent e)
    {
        Object src = e.getSource();

        if (src.equals(quitButton))
        {
            System.exit(0);
        }
    }

    static public void main(String[] args)
    {
        WindowTest w = new WindowTest();
    }
}

_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to