Java Reference
In-Depth Information
public void changeHighlight(Object tag, int p0, int p1)
throws BadLocationException;
public void deinstall(JTextComponent component);
public void install(JTextComponent component)
public void paint(Graphics g);
public void removeAllHighlights();
public void removeHighlight(Object tag);
}
The Caret interface describes the current cursor, as well as several selection attributes. Of
the Highlighter and Caret interfaces, the latter is the one that you would actually use, although
it isn't necessary to subclass it.
public interface Caret {
// Properties
public int getBlinkRate();
public void setBlinkRate(int newValue);
public int getDot();
public void setDot(int newValue);
public Point getMagicCaretPosition();
public void setMagicCaretPosition(Point newValue);
public int getMark();
public boolean isSelectionVisible();
public void setSelectionVisible(boolean newValue);
public boolean isVisible();
public void setVisible(boolean newValue);
// Listeners
public void addChangeListener(ChangeListener l);
public void removeChangeListener(ChangeListener l);
// Other methods
public void deinstall(JTextComponent c);
public void install(JTextComponent c);
public void moveDot(int dot);
public void paint(Graphics g);
}
Table 15-4 lists the six attributes of Caret .
Table 15-4. Caret Properties
Property Name
Data Type
Access
blinkRate
int
Read-write
dot
int
Read-write
magicCaretPosition
Point
Read-write
mark
int
Read-only
selectionVisible
boolean
Read-write
visible
boolean
Read-write
Search WWH ::




Custom Search