import java.awt.*; import java.applet.*; public class Sovelma2 extends Applet { private int lastx, lasty; private Color vari = Color.blue; private Button Kumi; public void init() { Kumi = new Button("Poista"); this.add(Kumi); } public void paint (Graphics G){ Kumi.reshape(10, 10, 50, 20); } public boolean mouseDown (Event e, int x, int y ) { lastx=x; lasty=y; return true; } public boolean mouseDrag (Event e, int x, int y ) { Graphics g = this.getGraphics(); g.setColor(vari); g.drawLine(lastx, lasty, x, y); lastx=x; lasty=y; return true; } public boolean action (Event e, Object arg) { if (e.target == Kumi) { repaint(); return true; } else return super.action (e, arg); } }