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

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YDAT | YWAIT | Byzgraf | FAQs
AdjustmentEvent typedict
 
An AdjustmentEvent is a low level event generated by a scrollbar that indicates its value has changed. The AWT and Swing components that can currently receive AdjustmentEvents include JList, JScrollBar, JScrollPane, JTable, JTextArea, JTextPane. Scrollbar, and ScrollPane. The fields in an AdjustmentEvent 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.

orientation An int that indicates the orientation of the scrollbar that is responsible for the event. This field was added so an adjustmentValueChanged event handler defined in a JList, JScrollPane, JTable, JTextArea, JTextPane. or ScrollPane can figure out which scrollbar triggered the event.
type An int that indicates the kind of adjustment that was made to the scrollbar. The value should be one of BLOCK_DECREMENT, BLOCK_INCREMENT, TRACK, UNIT_DECREMENT, or UNIT_INCREMENT, which are all defined in yoix.awt and yoix.swing.
value An int that represents the new value of the scrollbar.
JScrollBar and Scrollbar are the only components that can receive AdjustmentEvents, but they only arrive if the component has defined an adjustmentValueChanged event handler.
 
 Event Handlers:   adjustmentValueChanged
 
 Example:   The program,
import yoix.*.*;

VM.exitmodel = 0;      // so main thread does not exit

JScrollBar scrollbar = {
    adjustmentValueChanged(Event e) {
        printf("Received: %O\n", e);
        exit(0);
    }
};

AdjustmentEvent event = {
    String  id = "adjustmentValueChanged";
    int     type = BLOCK_INCREMENT;
    int     value = 23;
};

printf("Posting: %O\n", event);
postEvent(event, scrollbar);
prints
Posting: Event[3:0]
    id=^"adjustmentValueChanged"
   >type=4
    value=23
Received: Event[3:0]
    id=601
   >type=4
    value=23
on standard output. Notice how the id field changed from a string to the corresponding integer by the time adjustmentValueChanged got the event.
 
 See Also:   ActionEvent, CaretEvent, 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 Intellectual Property.