[572] in java-interest

home help back first fref pref prev next nref lref last post

applet graphics not clearing each time paint() is called

daemon@ATHENA.MIT.EDU (David Sklar)
Sat Jul 1 20:35:27 1995

From: David Sklar <t-davids@microsoft.com>
To: java-interest@java.Eng.Sun.COM
Date: Fri, 30 Jun 95 16:45:10 PDT

How can I tell a simple applet (and/or it's Graphics object) not to 
clear each time paint is called?

i.e. how can I make something simple like the following code from 
having only 1 line get drawn at once....?

class silly extends Applet implements Runnable {
	int h = 0;
	int v = 0;
	int oh = 0;
	int ov = 0;

	public void init() {
		resize(200,200);
	}

	public void paint(Graphics g) {
		g.drawLine(oh,ov,h,v);
	}

	public void mouseDown(int x, int y) {
		oh = h;
		ov = v;
		h = x;
		v = y;
		repaint();
	}
}


-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post