AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YDAT | YWAIT | Byzgraf | FAQs
PaintEvent typedict
 
A PaintEvent is a high level event that tells a component it should repaint itself, perhaps after first painting its background. There are no official PaintEvent event handlers, but many components support a Yoix paint function, so sending a PaintEvent to a component using postEvent eventually results in a call of the component's paint function. The fields in a PaintEvent are:
id A String that should only be "paint" or "update". A PaintEvent identified as an update always starts by repainting the component's background.
updaterect A Rectangle that describes the rectangle that needs to be repainted. Coordinates are in a coordinate system that has its origin in the component's upper left corner, positive x to the right, positive y down, and a resolution of 72 dots per inch. A NULL rectangle means repaint the entire component.
A PaintEvent can be sent to any component, but there are no official event handlers (i.e., Yoix functions that actually get the event), because much of the work is handled behind the scenes by the Java Virtual Machine. Many Yoix components support a paint function that is called whenever the component is painted, so sending a PaintEvent to a component using postEvent eventually results in a call of the component's paint function, however you should not count on a one to one correspondence between PaintEvents and paint calls.
 
 Event Handlers:   none
 
 Example:   The program,
import yoix.*.*;

double factor = 1.0;

Frame f = {
    Color background = Color.white;
    int   visible = TRUE;

    paint(Rectangle rect) {
        graphics {
            gsave();
            rectclip(rect);
            moveto(72, 72);
            rlineto(288, 0);
            rlineto(0, 72);
            rlineto(-288, 0);
            setrgbcolor(1.0 - factor, factor, 0);
            fill();
            grestore();
            rectstroke(rect);
        }
    }
};

PaintEvent pe = {
    String id = "paint";
    Rectangle updaterect = {
        double x = 72;
        double y = 72;
        double width = 288;
        double height = 72;
    };
};

while (pe.updaterect.width > 18) {
    sleep(.5);
    factor *= .8;
    pe.updaterect.width = 288*factor;
    postEvent(pe, f);
}

sleep(1);
exit(0);
sends a series of PaintEvents to a frame that defines a paint function that lets you observe the events as they arrive.
 
 See Also:   ActionEvent, AdjustmentEvent, CaretEvent, ChangeEvent, ComponentEvent, DragGestureEvent, DragSourceEvent, DropTargetEvent, Event, FocusEvent, HyperlinkEvent, InvocationEvent, invokeLater, isDispatchThread, ItemEvent, KeyEvent, ListSelectionEvent, MouseEvent, MouseWheelEvent, postEvent, TextEvent, TreeSelectionEvent, WindowEvent

 

Yoix is a registered trademark of AT&T Intellectual Property.