All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface com.sun.java.swing.text.Caret

public interface Caret
A place within a document view that represents where things can be inserted into the document model. It gives a way to navigate through the document view while abstracting away the details of how the view is arranged. This can be useful because some views may filter out portions of the associated model, and some views may not allow navigation in certain areas such as read-only areas.


Variable Index

 o backwardAction
Name of the Action for moving the caret logically backward one position.
 o beginAction
Name of the Action for moving the caret to the begining of the document.
 o beginParagraphAction
Name of the Action for moving the caret to the begin of the paragraph
 o downAction
Name of the Action for moving the caret logically downward one position.
 o endAction
Name of the Action for moving the caret to the end of the document.
 o endParagraphAction
Name of the Action for moving the caret to the end of the paragraph
 o forwardAction
Name of the Action for moving the caret logically forward one position.
 o selectionBackwardAction
Name of the Action for extending the selection by moving the caret logically backward one position.
 o selectionForwardAction
Name of the Action for extending the selection by moving the caret logically forward one position.
 o upAction
Name of the Action for moving the caret logically upward one position.

Method Index

 o addChangeListener(ChangeListener)
Adds a listener to track whenever the caret position has been changed.
 o deinstall(JTextComponent)
Called when the UI is being removed from the interface of a JTextComponent.
 o getActions()
Fetches the command list for navigating the caret through the view.
 o getDot()
Fetches the current position of the caret.
 o getMagicCaretPosition()
Gets the current caret position.
 o getMark()
Fetches the current position of the mark.
 o install(JTextComponent)
Called when the UI is being installed into the interface of a JTextComponent.
 o isVisible()
Determines if the caret is currently visible.
 o moveDot(int)
Moves the caret position to some other position, leaving behind the mark.
 o removeChangeListener(ChangeListener)
Removes a listener that was tracking caret position changes.
 o setBlinkRate(int)
Sets the blink rate of the caret.
 o setDot(int)
Sets the caret position to some position.
 o setMagicCaretPosition(Point)
Saves the current caret position.
 o setVisible(boolean)
Sets the visibility of the caret.

Variables

 o forwardAction
 public static final String forwardAction
Name of the Action for moving the caret logically forward one position.

See Also:
getActions
 o backwardAction
 public static final String backwardAction
Name of the Action for moving the caret logically backward one position.

See Also:
getActions
 o selectionForwardAction
 public static final String selectionForwardAction
Name of the Action for extending the selection by moving the caret logically forward one position.

See Also:
getActions
 o selectionBackwardAction
 public static final String selectionBackwardAction
Name of the Action for extending the selection by moving the caret logically backward one position.

See Also:
getActions
 o upAction
 public static final String upAction
Name of the Action for moving the caret logically upward one position.

See Also:
getActions
 o downAction
 public static final String downAction
Name of the Action for moving the caret logically downward one position.

See Also:
getActions
 o endParagraphAction
 public static final String endParagraphAction
Name of the Action for moving the caret to the end of the paragraph

See Also:
getActions
 o beginParagraphAction
 public static final String beginParagraphAction
Name of the Action for moving the caret to the begin of the paragraph

See Also:
getActions
 o beginAction
 public static final String beginAction
Name of the Action for moving the caret to the begining of the document.

See Also:
getActions
 o endAction
 public static final String endAction
Name of the Action for moving the caret to the end of the document.

See Also:
getActions

Methods

 o install
 public abstract void install(JTextComponent c)
Called when the UI is being installed into the interface of a JTextComponent. This can be used to gain access to the model that is being navigated by the implementation of this interface.

Parameters:
c - the component
 o deinstall
 public abstract void deinstall(JTextComponent c)
Called when the UI is being removed from the interface of a JTextComponent. This is used to unregister any listeners that were attached.

Parameters:
c - the component
 o addChangeListener
 public abstract void addChangeListener(ChangeListener l)
Adds a listener to track whenever the caret position has been changed.

Parameters:
l - the change listener
 o removeChangeListener
 public abstract void removeChangeListener(ChangeListener l)
Removes a listener that was tracking caret position changes.

Parameters:
l - the change listener
 o isVisible
 public abstract boolean isVisible()
Determines if the caret is currently visible.

Returns:
true if the caret is visible else false
 o setVisible
 public abstract void setVisible(boolean v)
Sets the visibility of the caret.

Parameters:
v - this is true if the caret should be shown, and false if the caret should be hidden
 o setMagicCaretPosition
 public abstract void setMagicCaretPosition(Point p)
Saves the current caret position. This used when caret up or down actions occur, moving between lines that have uneven end positions.

Parameters:
p - the Point to use for the saved position
 o getMagicCaretPosition
 public abstract Point getMagicCaretPosition()
Gets the current caret position.

See Also:
setMagicCaretPosition
 o setBlinkRate
 public abstract void setBlinkRate(int rate)
Sets the blink rate of the caret. This determines if and how fast the caret blinks, commonly used as one way to attract attention to the caret.

Parameters:
rate - the delay in milliseconds. If this is zero the caret will not blink.
 o getDot
 public abstract int getDot()
Fetches the current position of the caret.

Returns:
the position
 o getMark
 public abstract int getMark()
Fetches the current position of the mark. If there is a selection, the mark will not be the same as the dot.

Returns:
the position
 o setDot
 public abstract void setDot(int dot)
Sets the caret position to some position. This causes the mark to become the same as the dot, effectively setting the selection range to zero.

Parameters:
dot - the new position to set the caret to
 o moveDot
 public abstract void moveDot(int dot)
Moves the caret position to some other position, leaving behind the mark. This is useful for making selections.

Parameters:
dot - the new position to move the caret to
 o getActions
 public abstract Action[] getActions()
Fetches the command list for navigating the caret through the view.

Returns:
the command list

All Packages  Class Hierarchy  This Package  Previous  Next  Index