| TextEvent |
|
typedict |
| |
A
TextEvent
indicates that the value in a component, like a
JTextField
or
TextArea,
has changed.
The fields in a
TextEvent
are:
| 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.
| | length |
An
int
that indicates the length of the change if it is greater than or equal to
0.
A negative value, which is what an AWT
textValueChanged
event handler should always expect, means
length
contains no useful information.
| | offset |
An
int
that indicates the where the change happened if it is greater than or equal to
0.
A negative value, which is what an AWT
textValueChanged
event handler should always expect, means
offset
contains no useful information.
| | type |
An
int
that provides additional information about the change,
but only when its value is
TEXTINSERT,
or
TEXTREMOVE,
which are defined in
yoix.awt
and
yoix.swing.
A value of
TEXTCHANGE,
which is what an AWT
textValueChanged
event handler should always expect, means
type
contains no useful information.
|
JComboBox,
JTextArea,
JTextField,
JTextPane,
TextArea,
and
TextField
are the only components that can receive
TextEvents,
but they only arrive if the component has defined a
textValueChanged
event handler.
In the case of a
JComboBox,
the combobox needs to be editable.
| |
| Event Handlers: |
textValueChanged
| | |
| Example: |
The program,
import yoix.*.*;
Frame frame = {
Array layout = {
new TextArea {
String tag = "textarea";
int edit = 1;
textValueChanged(Event e) {
printf("textValueChanged: %O\n", e);
if (indexOf(text, "QUIT") >= 0)
exit(0);
}
}, CENTER
};
};
frame.visible = TRUE;
TextEvent event = {
String id = "textValueChanged";
};
printf("Posting: %O\n", event);
postEvent(event, frame.components.textarea);
prints
Posting: Event[4:0]
id=^"textValueChanged"
length=-1
>offset=-1
type=0
textValueChanged: Event[4:0]
id=900
length=-1
>offset=-1
type=0
on standard output and then dumps all real
textValueChanged
events until you type
QUIT
somewhere in the TextArea.
| | |
| See Also: |
ActionEvent,
AdjustmentEvent,
CaretEvent,
ChangeEvent,
ComponentEvent,
DragGestureEvent,
DragSourceEvent,
DropTargetEvent,
Event,
FocusEvent,
HyperlinkEvent,
InvocationEvent,
invokeLater,
isDispatchThread,
ItemEvent,
KeyEvent,
ListSelectionEvent,
MouseEvent,
MouseWheelEvent,
PaintEvent,
postEvent,
TreeSelectionEvent,
WindowEvent
|
|
Yoix is a registered trademark of AT&T Intellectual Property.
|
|