[kaffe] bug about graphics cache

yinzhong shang yzshang at gmail.com
Tue Apr 26 01:48:31 PDT 2005


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

public class HelloWorld extends Frame {
    public static void main(String[] args) throws Exception {
        final Frame frame = new HelloWorld();
        final Frame frame2 = new HelloWorld();
        frame.setSize(200, 200);
        frame2.setBounds(200, 200, 200,200);
        frame2.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent we) {
                    frame.dispose();
                    frame2.dispose();
                    System.exit(0);
                }
            }
        );
        frame.setVisible(true);
        frame2.setVisible(true);
    }

    public void paint(Graphics g) {
        g.setFont(new Font("Dialog", Font.PLAIN, 50));
        g.setColor(Color.red);
        g.drawString("Hello World", 150, 100);
    }
}

I run this simple program with kaffe-nanox, the frame2's text ("hello
world") is not correctly displayed. the position is wrong. and I debug
it find that it is NativeGraphics.java 's cache  problem. so i close
the cache, and the display  then is correct.




More information about the kaffe mailing list