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

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
WindowEvent typedict
 
A WindowEvent indicates something important has happened to a component, like a JFrame or Dialog, that can be displayed as a window on your screen. The only field in a WindowEvent is:
id An Object that must be an int or String, that identifies the type of this event. A value that is a String must be the name of an event handler that can process this event. A value that is an int must be a number that the yoix.event.HandlerID dictionary associates with an event handler that can process this event.

In practice, id is only used when you build an event that gets handed to postEvent, and in that case the value assigned to id is almost always a String.

JDialog, JFileDialog, JFrame, JInternalFrame, JWindow, Dialog, FileDialog, Frame, and Window are the only components that can receive WindowEvents, but they only arrive if the component has defined one or more of the event handlers listed below.
 
 Event Handlers:   windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
 
 Example:   The program,
import yoix.*.*;

JFrame frame = {
    windowOpened(Event e) {
        printf("windowOpened: %O\n", e);
    }
    windowClosed(Event e) {
        printf("windowClosed: %O\n", e);
    }
};

WindowEvent event = {
    String id = "windowClosed";
};

printf("Posting %s\n", event.id);
postEvent(event, frame);
sleep(2);
frame.visible = TRUE;
sleep(2);
frame.visible = FALSE;
sleep(2);
frame.visible = TRUE;
sleep(2);
frame.dispose = TRUE;
sleep(2);
exit(0);
prints
Posting windowClosed
windowClosed: Event[1:0]
   >id=202
windowOpened: Event[1:0]
   >id=200
windowClosed: Event[1:0]
   >id=202
on standard output.
 
 See Also:   ActionEvent, AdjustmentEvent, CaretEvent, ChangeEvent, ComponentEvent, DragGestureEvent, DragSourceEvent, DropTargetEvent, Event, FocusEvent, HyperlinkEvent, InvocationEvent, invokeLater, isDispatchThread, ItemEvent, KeyEvent, ListSelectionEvent, MouseEvent, MouseWheelEvent, PaintEvent, postEvent, TextEvent, TreeSelectionEvent

 

Yoix is a registered trademark of AT&T Inc.