| ChangeEvent |
|
typedict |
| |
A
ChangeEvent
indicates that something in a Swing component, like a JButton,
has changed.
The only field in a
ChangeEvent
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.
|
JButton
(and related buttons),
JColorChooser,
JProgressBar,
JSlider,
and
JTabbedPane
are the only components that can receive
ChangeEvents,
but they only arrive if the component has defined a
stateChanged
event handler.
| |
| Event Handlers: |
stateChanged
| | |
| Example: |
The program,
import yoix.*.*;
JFrame f = {
Array layout = {
new JButton {
String text = "Test Button";
stateChanged(Event e) {
printf("stateChanged: e=%O\n", e);
}
actionPerformed(Event e) {
printf("actionPerformed: e=%O\n", e);
}
}, SOUTH
};
};
f.visible = TRUE;
puts a
JButton
at the bottom of a
JFrame
and defines handlers for
ChangeEvent
and
ActionEvent
events.
Move the pointer into and out of the button or click on it and
the appropriate handler will be called.
| | |
| See Also: |
ActionEvent,
AdjustmentEvent,
CaretEvent,
ComponentEvent,
DragGestureEvent,
DragSourceEvent,
DropTargetEvent,
Event,
FocusEvent,
HyperlinkEvent,
InvocationEvent,
invokeLater,
isDispatchThread,
ItemEvent,
KeyEvent,
ListSelectionEvent,
MouseEvent,
MouseWheelEvent,
PaintEvent,
postEvent,
TextEvent,
TreeSelectionEvent,
WindowEvent
|
|
Yoix is a registered trademark of AT&T Intellectual Property.
|