| postEvent |
(Event event, Object comp) |
yoix.swing |
| |
Tries to send a copy of
event
through Java's AWT event queue to
comp,
which should be a Yoix object that represents an AWT or Swing component,
and returns non-zero if
event
was successfully queued.
The event is dispatched to
comp
when it reaches the head of the event queue and finds an event handler
(a function) defined in
comp
that matches the
id
field in
event.
The names listed in the
yoix.event.HandlerID
dictionary are the only strings that should be assigned to the
id
field.
| |
| Example: |
The program,
import yoix.*.*;
VM.exitmodel = 0; // so main thread does not exit
JButton button = {
mousePressed(Event e) {
printf("Event=%O\n", e);
printf("sleeping...\n");
sleep(2);
exit(0);
}
};
MouseEvent event = {
String id = "mousePressed";
};
postEvent(event, button);
shows how you can send a
mousePressed
event to a
Button.
| | |
| Return: |
int
| | |
| See Also: |
ActionEvent,
AdjustmentEvent,
CaretEvent,
ChangeEvent,
ComponentEvent,
Event,
FocusEvent,
HyperlinkEvent,
InvocationEvent,
invokeLater,
isDispatchThread,
ItemEvent,
KeyEvent,
ListSelectionEvent,
MouseEvent,
MouseWheelEvent,
PaintEvent,
TextEvent,
TreeSelectionEvent,
WindowEvent
|
|
Yoix is a registered trademark of AT&T Inc.
|