FileDocCategorySizeDatePackage
ClearableScribble.javaAPI DocExample1306Fri Feb 16 13:29:24 GMT 1996None

ClearableScribble

public class ClearableScribble extends ColorScribble

Fields Summary
private Button
clear_button
Constructors Summary
Methods Summary
public booleanaction(java.awt.Event event, java.lang.Object arg)

        // If our button was clicked on, handle it.
        // Otherwise, let our superclass handle it if it wants to.
        if (event.target == clear_button) {
            Graphics g = this.getGraphics();
            Rectangle r = this.bounds();
            g.setColor(this.getBackground());
            g.fillRect(r.x, r.y, r.width, r.height);
            g.setColor(this.getForeground());
            return true;
        }
        else return super.action(event, arg);
    
public voidinit()

        // do ColorScribble initialization first
        super.init();
        // Create a button and add it to the applet.
        clear_button = new Button("Clear");
        clear_button.setForeground(Color.black);
        clear_button.setBackground(Color.lightGray);
        this.add(clear_button);