Dustin Lang wrote:
>
> Hi again,
>
> I ran Test on NT and it does the same thing.
>
> Weird...
>
> dstn.
>
> ---------------------------------
> Dustin Lang, [EMAIL PROTECTED]

With sync() from Toolkit after the painting (flush out
buffered graphics events), your example does what you would expect.
As i can see it on my Linux box:

import java.awt.*;
import java.awt.event.*;

public class Test extends Frame implements ActionListener {

        Light light;
        Button go;

        public static void main(String[] args) {
                new Test();
        }

        public Test() {
                light = new Light(15);
                light.setColor(Color.green);
                go = new Button("Go!");
                go.addActionListener(this);
                setBackground(Color.white);
                add("North", go);
                add("South", light);
                setTitle("Test!");
                pack();
                show();
        }

        public void actionPerformed(ActionEvent e) {
                light.setColor(Color.red);
                getToolkit().sync();
                try {
                        Thread.sleep(2000L);
                } catch (InterruptedException ie) {
                }
                light.setColor(Color.blue);
                getToolkit().sync();
                try {
                        Thread.sleep(2000L);
                } catch (InterruptedException ie) {
                }
                light.setColor(Color.green);
                getToolkit().sync();
        }
}

--
Juergen Sonnauer

Reply via email to