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
CaretEvent typedict
 
A CaretEvent is a Swing event that indicates a change in one of the positions (either dot or mark) associated with the text insertion caret maintained by a Swing text components like a JTextArea, JTextField, or JTextPane. The fields in a CaretEvent are:
dot An int that represents the insertion point as an index into the text string currently displayed by the component.
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.

mark An int that represents the mark point as an index into the text string currently displayed by the component.
JTextArea, JTextField, and JTextPane are the only components that can receive CaretEvents, but they only arrive if the component has defined a caretUpdate event handler.
 
 Event Handlers:   caretUpdate
 
 Example:   The program,
import yoix.*.*;

JFrame f = {
    Array layout = {
        new JTextArea {
            String text = "\n\nNow is the time\nfor all...";
            Color  background = Color.white;

            caretUpdate(Event e) {
                printf("caretUpdate: e=%O\n", e);
            }
        }, CENTER
    };
};

f.visible = TRUE;
puts a JTextArea in a JFrame and defines a handler for CaretEvents.
 
 See Also:   ActionEvent, AdjustmentEvent, ChangeEvent, 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 Inc.