DefaultCaret (Java Platform SE 8 ) (original) (raw)

Modifier and Type

Method

Description

void

[addChangeListener](../../../javax/swing/text/DefaultCaret.html#addChangeListener-javax.swing.event.ChangeListener-)([ChangeListener](../../../javax/swing/event/ChangeListener.html "interface in javax.swing.event") l)

Adds a listener to track whenever the caret position has been changed.

protected void

[adjustVisibility](../../../javax/swing/text/DefaultCaret.html#adjustVisibility-java.awt.Rectangle-)([Rectangle](../../../java/awt/Rectangle.html "class in java.awt") nloc)

Scrolls the associated view (if necessary) to make the caret visible.

protected void

[damage](../../../javax/swing/text/DefaultCaret.html#damage-java.awt.Rectangle-)([Rectangle](../../../java/awt/Rectangle.html "class in java.awt") r)

Damages the area surrounding the caret to cause it to be repainted in a new location.

void

[deinstall](../../../javax/swing/text/DefaultCaret.html#deinstall-javax.swing.text.JTextComponent-)([JTextComponent](../../../javax/swing/text/JTextComponent.html "class in javax.swing.text") c)

Called when the UI is being removed from the interface of a JTextComponent.

boolean

[equals](../../../javax/swing/text/DefaultCaret.html#equals-java.lang.Object-)([Object](../../../java/lang/Object.html "class in java.lang") obj)

Compares this object to the specified object.

protected void

[fireStateChanged](../../../javax/swing/text/DefaultCaret.html#fireStateChanged--)()

Notifies all listeners that have registered interest for notification on this event type.

void

[focusGained](../../../javax/swing/text/DefaultCaret.html#focusGained-java.awt.event.FocusEvent-)([FocusEvent](../../../java/awt/event/FocusEvent.html "class in java.awt.event") e)

Called when the component containing the caret gains focus.

void

[focusLost](../../../javax/swing/text/DefaultCaret.html#focusLost-java.awt.event.FocusEvent-)([FocusEvent](../../../java/awt/event/FocusEvent.html "class in java.awt.event") e)

Called when the component containing the caret loses focus.

int

[getBlinkRate](../../../javax/swing/text/DefaultCaret.html#getBlinkRate--)()

Gets the caret blink rate.

[ChangeListener](../../../javax/swing/event/ChangeListener.html "interface in javax.swing.event")[]

[getChangeListeners](../../../javax/swing/text/DefaultCaret.html#getChangeListeners--)()

Returns an array of all the change listeners registered on this caret.

protected [JTextComponent](../../../javax/swing/text/JTextComponent.html "class in javax.swing.text")

[getComponent](../../../javax/swing/text/DefaultCaret.html#getComponent--)()

Gets the text editor component that this caret is is bound to.

int

[getDot](../../../javax/swing/text/DefaultCaret.html#getDot--)()

Fetches the current position of the caret.

[Position.Bias](../../../javax/swing/text/Position.Bias.html "class in javax.swing.text")

[getDotBias](../../../javax/swing/text/DefaultCaret.html#getDotBias--)()

Returns the bias of the caret position.

<T extends [EventListener](../../../java/util/EventListener.html "interface in java.util")> T[]

[getListeners](../../../javax/swing/text/DefaultCaret.html#getListeners-java.lang.Class-)([Class](../../../java/lang/Class.html "class in java.lang")<T> listenerType)

Returns an array of all the objects currently registered as _Foo_Listeners upon this caret.

[Point](../../../java/awt/Point.html "class in java.awt")

[getMagicCaretPosition](../../../javax/swing/text/DefaultCaret.html#getMagicCaretPosition--)()

Gets the saved caret position.

int

[getMark](../../../javax/swing/text/DefaultCaret.html#getMark--)()

Fetches the current position of the mark.

[Position.Bias](../../../javax/swing/text/Position.Bias.html "class in javax.swing.text")

[getMarkBias](../../../javax/swing/text/DefaultCaret.html#getMarkBias--)()

Returns the bias of the mark.

protected [Highlighter.HighlightPainter](../../../javax/swing/text/Highlighter.HighlightPainter.html "interface in javax.swing.text")

[getSelectionPainter](../../../javax/swing/text/DefaultCaret.html#getSelectionPainter--)()

Gets the painter for the Highlighter.

int

[getUpdatePolicy](../../../javax/swing/text/DefaultCaret.html#getUpdatePolicy--)()

Gets the caret movement policy on document updates.

void

[install](../../../javax/swing/text/DefaultCaret.html#install-javax.swing.text.JTextComponent-)([JTextComponent](../../../javax/swing/text/JTextComponent.html "class in javax.swing.text") c)

Called when the UI is being installed into the interface of a JTextComponent.

boolean

[isActive](../../../javax/swing/text/DefaultCaret.html#isActive--)()

Determines if the caret is currently active.

boolean

[isSelectionVisible](../../../javax/swing/text/DefaultCaret.html#isSelectionVisible--)()

Checks whether the current selection is visible.

boolean

[isVisible](../../../javax/swing/text/DefaultCaret.html#isVisible--)()

Indicates whether or not the caret is currently visible.

void

[mouseClicked](../../../javax/swing/text/DefaultCaret.html#mouseClicked-java.awt.event.MouseEvent-)([MouseEvent](../../../java/awt/event/MouseEvent.html "class in java.awt.event") e)

Called when the mouse is clicked.

void

[mouseDragged](../../../javax/swing/text/DefaultCaret.html#mouseDragged-java.awt.event.MouseEvent-)([MouseEvent](../../../java/awt/event/MouseEvent.html "class in java.awt.event") e)

Moves the caret position according to the mouse pointer's current location.

void

[mouseEntered](../../../javax/swing/text/DefaultCaret.html#mouseEntered-java.awt.event.MouseEvent-)([MouseEvent](../../../java/awt/event/MouseEvent.html "class in java.awt.event") e)

Called when the mouse enters a region.

void

[mouseExited](../../../javax/swing/text/DefaultCaret.html#mouseExited-java.awt.event.MouseEvent-)([MouseEvent](../../../java/awt/event/MouseEvent.html "class in java.awt.event") e)

Called when the mouse exits a region.

void

[mouseMoved](../../../javax/swing/text/DefaultCaret.html#mouseMoved-java.awt.event.MouseEvent-)([MouseEvent](../../../java/awt/event/MouseEvent.html "class in java.awt.event") e)

Called when the mouse is moved.

void

[mousePressed](../../../javax/swing/text/DefaultCaret.html#mousePressed-java.awt.event.MouseEvent-)([MouseEvent](../../../java/awt/event/MouseEvent.html "class in java.awt.event") e)

If button 1 is pressed, this is implemented to request focus on the associated text component, and to set the caret position.

void

[mouseReleased](../../../javax/swing/text/DefaultCaret.html#mouseReleased-java.awt.event.MouseEvent-)([MouseEvent](../../../java/awt/event/MouseEvent.html "class in java.awt.event") e)

Called when the mouse is released.

protected void

[moveCaret](../../../javax/swing/text/DefaultCaret.html#moveCaret-java.awt.event.MouseEvent-)([MouseEvent](../../../java/awt/event/MouseEvent.html "class in java.awt.event") e)

Tries to move the position of the caret from the coordinates of a mouse event, using viewToModel().

void

[moveDot](../../../javax/swing/text/DefaultCaret.html#moveDot-int-)(int dot)

Moves the caret position to the specified position, with a forward bias.

void

[moveDot](../../../javax/swing/text/DefaultCaret.html#moveDot-int-javax.swing.text.Position.Bias-)(int dot,[Position.Bias](../../../javax/swing/text/Position.Bias.html "class in javax.swing.text") dotBias)

Moves the caret position to the specified position, with the specified bias.

void

[paint](../../../javax/swing/text/DefaultCaret.html#paint-java.awt.Graphics-)([Graphics](../../../java/awt/Graphics.html "class in java.awt") g)

Renders the caret as a vertical line.

protected void

[positionCaret](../../../javax/swing/text/DefaultCaret.html#positionCaret-java.awt.event.MouseEvent-)([MouseEvent](../../../java/awt/event/MouseEvent.html "class in java.awt.event") e)

Tries to set the position of the caret from the coordinates of a mouse event, using viewToModel().

void

[removeChangeListener](../../../javax/swing/text/DefaultCaret.html#removeChangeListener-javax.swing.event.ChangeListener-)([ChangeListener](../../../javax/swing/event/ChangeListener.html "interface in javax.swing.event") l)

Removes a listener that was tracking caret position changes.

protected void

[repaint](../../../javax/swing/text/DefaultCaret.html#repaint--)()

Cause the caret to be painted.

void

[setBlinkRate](../../../javax/swing/text/DefaultCaret.html#setBlinkRate-int-)(int rate)

Sets the caret blink rate.

void

[setDot](../../../javax/swing/text/DefaultCaret.html#setDot-int-)(int dot)

Sets the caret position and mark to the specified position, with a forward bias.

void

[setDot](../../../javax/swing/text/DefaultCaret.html#setDot-int-javax.swing.text.Position.Bias-)(int dot,[Position.Bias](../../../javax/swing/text/Position.Bias.html "class in javax.swing.text") dotBias)

Sets the caret position and mark to the specified position, with the specified bias.

void

[setMagicCaretPosition](../../../javax/swing/text/DefaultCaret.html#setMagicCaretPosition-java.awt.Point-)([Point](../../../java/awt/Point.html "class in java.awt") p)

Saves the current caret position.

void

[setSelectionVisible](../../../javax/swing/text/DefaultCaret.html#setSelectionVisible-boolean-)(boolean vis)

Changes the selection visibility.

void

[setUpdatePolicy](../../../javax/swing/text/DefaultCaret.html#setUpdatePolicy-int-)(int policy)

Sets the caret movement policy on the document updates.

void

[setVisible](../../../javax/swing/text/DefaultCaret.html#setVisible-boolean-)(boolean e)

Sets the caret visibility, and repaints the caret.

[String](../../../java/lang/String.html "class in java.lang")

[toString](../../../javax/swing/text/DefaultCaret.html#toString--)()

Returns a String representing thisRectangle and its values.