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
setHighlights (Object comp, Array highlights [, int fields]) yoix.swing
 
Sets the highlights in comp, which must be a JTextArea, JTextField, or JTextPane based on the values in the highlights array and the optional fields arguments. Omitting fields, or setting it to 2, means the highlights array only contains starting and ending offsets for each highlight. Setting fields to 3 means the color of each highlight in included in highlights, right after its ending offset. Setting fields to 4 means highlights includes a flags entry that identifies the type of each highlight (1 means the caret, 2 means the owner of the caret, 4 covers everything else).

Text can be highlighted by user actions (e.g., by dragging the mouse) or by setHighlights, but in all cases what actually happens is controlled by the highlightflags field that is defined in a JTextArea, JTextField, and JTextPane. The two most common settings for highlightflags are 0 (all flags off) which is the default and produces normal behavior, and 0xFF (almost all flags on) which enables fancy things like multiple highlights (0x04) that are not changed by user actions (0x02) and are not removed when the focus changes (0x01). In addition one highlight can be marked as a caret (0x10) and different highlight can be marked as the owner of the caret (0x20), which restricts the movement of the caret to the bounds of its owner.
 
 Return:   Array
 
 See Also:   getHighlights, JTextArea, JTextField, JTextPane

 

Yoix is a registered trademark of AT&T Inc.