javax.swing.text
Class DefaultCaret

java.lang.Object
  |
  +--java.awt.geom.RectangularShape
        |
        +--java.awt.geom.Rectangle2D
              |
              +--java.awt.Rectangle
                    |
                    +--javax.swing.text.DefaultCaret
All Implemented Interfaces:
Caret, Cloneable, EventListener, FocusListener, MouseListener, MouseMotionListener, Serializable, Shape
Direct Known Subclasses:
javax.swing.text.JTextComponent.ComposedTextCaret

public class DefaultCaret
extends Rectangle
implements Caret, FocusListener, MouseListener, MouseMotionListener

Safe: A default implementation of Caret. The caret is rendered as a vertical line in the color specified by the CaretColor property of the associated JTextComponent. It can blink at the rate specified by the BlinkRate property.

This implementation expects two sources of asynchronous notification. The timer thread fires asynchronously, and causes the caret to simply repaint the most recent bounding box. The caret also tracks change as the document is modified. Typically this will happen on the event thread as a result of some mouse or keyboard event. Updates can also occur from some other thread mutating the document. There is a property AsynchronousMovement that determines if the caret will move on asynchronous updates. The default behavior is to not update on asynchronous updates. If asynchronous updates are allowed, the update thread will fire the caret position change to listeners asynchronously. The repaint of the new caret location will occur on the event thread in any case, as calls to modelToView are only safe on the event thread.

The caret acts as a mouse and focus listener on the text component it has been installed in, and defines the caret semantics based upon those events. The listener methods can be reimplemented to change the semantics. By default, the first mouse button will be used to set focus and caret position. Dragging the mouse pointer with the first mouse button will sweep out a selection that is contiguous in the model. If the associated text component is editable, the caret will become visible when focus is gained, and invisible when focus is lost.

The Highlighter bound to the associated text component is used to render the selection by default. Selection appearance can be customized by supplying a painter to use for the highlights. By default a painter is used that will render a solid color as specified in the associated text component in the SelectionColor property. This can easily be changed by reimplementing the getSelectionHighlighter method.

A customized caret appearance can be achieved by reimplementing the paint method. If the paint method is changed, the damage method should also be reimplemented to cause a repaint for the area needed to render the caret. The caret extends the Rectangle class which is used to hold the bounding box for where the caret was last rendered. This enables the caret to repaint in a thread-safe manner when the caret moves without making a call to modelToView which is unstable between model updates and view repair (i.e. the order of delivery to DocumentListeners is not guaranteed).

The magic caret position is set to null when the caret position changes. A timer is used to determine the new location (after the caret change). When the timer fires, if the magic caret position is still null it is reset to the current caret position. Any actions that change the caret position and want the magic caret position to remain the same, must remember the magic caret position, change the cursor, and then set the magic caret position to its original value. This has the benefit that only actions that want the magic caret position to persist (such as open/down) need to know about it.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder.

Version:
1.118 03/04/02
Author:
Timothy Prinzing
See Also:
Caret, Serialized Form

Field Summary
(package private)  boolean async
          flag to indicate if async updates should move the caret.
protected  ChangeEvent changeEvent
          The change event for the model.
private  ClipboardOwner clipboardOwner
           
(package private)  JTextComponent component
           
(package private)  int dot
           
(package private)  javax.swing.text.Position.Bias dotBias
           
(package private)  boolean dotLTR
           
private  javax.swing.text.NavigationFilter.FilterBypass filterBypass
           
private  int[] flagXPoints
           
private  int[] flagYPoints
           
(package private)  Timer flasher
           
private  FocusListener focusListener
           
private  boolean forceCaretPositionChange
          If this is true, the location of the dot is updated regardless of the current location.
protected  EventListenerList listenerList
          The event listener list.
(package private)  Point magicCaretPosition
           
(package private)  int mark
           
(package private)  javax.swing.text.Position.Bias markBias
           
(package private)  boolean markLTR
           
private  boolean ownsSelection
          This is used to indicate if the caret currently owns the selection.
(package private)  Object selectionTag
           
(package private)  boolean selectionVisible
           
private  boolean shouldHandleRelease
          Whether or not mouseReleased should adjust the caret and focus.
(package private)  javax.swing.text.DefaultCaret.UpdateHandler updateHandler
           
(package private)  boolean visible
           
 
Fields inherited from class java.awt.Rectangle
height, width, x, y
 
Constructor Summary
DefaultCaret()
          Enabled: Constructs a default caret.
 
Method Summary
private  boolean _contains(int X, int Y, int W, int H)
           
 void addChangeListener(ChangeListener l)
          Enabled: Adds a listener to track whenever the caret position has been changed.
private  void adjustCaret(MouseEvent e)
          Adjusts the caret location based on the MouseEvent.
(package private)  void adjustCaretAndFocus(MouseEvent e)
           
private  void adjustFocus(boolean inWindow)
          Adjusts the focus, if necessary.
protected  void adjustVisibility(Rectangle nloc)
          Scrolls the associated view (if necessary) to make the caret visible.
(package private)  void changeCaretPosition(int dot, javax.swing.text.Position.Bias dotBias)
          Sets the caret position (dot) to a new location.
protected  void damage(Rectangle r)
          Damages the area surrounding the caret to cause it to be repainted in a new location.
 void deinstall(JTextComponent c)
          Suppressed: Called when the UI is being removed from the interface of a JTextComponent.
private  void ensureValidPosition()
          This is invoked after the document changes to verify the current dot/mark is valid.
 boolean equals(Object obj)
          Suppressed: Compares this object to the specified object.
protected  void fireStateChanged()
          Notifies all listeners that have registered interest for notification on this event type.
 void focusGained(FocusEvent e)
          Suppressed: Called when the component containing the caret gains focus.
 void focusLost(FocusEvent e)
          Suppressed: Called when the component containing the caret loses focus.
(package private)  boolean getAsynchronousMovement()
          Get the flag that determines whether or not asynchronous updates will move the caret.
 int getBlinkRate()
          Enabled: Gets the caret blink rate.
 ChangeListener[] getChangeListeners()
          Suppressed: Returns an array of all the change listeners registered on this caret.
private  ClipboardOwner getClipboardOwner()
           
protected  JTextComponent getComponent()
          Gets the text editor component that this caret is is bound to.
 int getDot()
          Enabled: Fetches the current position of the caret.
(package private)  javax.swing.text.Position.Bias getDotBias()
           
private  javax.swing.text.NavigationFilter.FilterBypass getFilterBypass()
           
 EventListener[] getListeners(Class listenerType)
          Suppressed: Returns an array of all the objects currently registered as FooListeners upon this caret.
 Point getMagicCaretPosition()
          Enabled: Gets the saved caret position.
 int getMark()
          Enabled: Fetches the current position of the mark.
(package private)  javax.swing.text.Position.Bias getMarkBias()
           
protected  javax.swing.text.Highlighter.HighlightPainter getSelectionPainter()
          Gets the painter for the Highlighter.
private  Clipboard getSystemSelection()
           
(package private)  javax.swing.text.Position.Bias guessBiasForOffset(int offset, javax.swing.text.Position.Bias lastBias, boolean lastLTR)
           
(package private)  void handleMoveDot(int dot, javax.swing.text.Position.Bias dotBias)
           
(package private)  void handleSetDot(int dot, javax.swing.text.Position.Bias dotBias)
           
 void install(JTextComponent c)
          Suppressed: Called when the UI is being installed into the interface of a JTextComponent.
(package private)  boolean isDotLeftToRight()
           
(package private)  boolean isMarkLeftToRight()
           
(package private)  boolean isPositionLTR(int position, javax.swing.text.Position.Bias bias)
           
 boolean isSelectionVisible()
          Enabled: Checks whether the current selection is visible.
 boolean isVisible()
          Enabled: Determines if the caret is currently visible.
 void mouseClicked(MouseEvent e)
          Suppressed: Called when the mouse is clicked.
 void mouseDragged(MouseEvent e)
          Suppressed: Moves the caret position according to the mouse pointer's current location.
 void mouseEntered(MouseEvent e)
          Suppressed: Called when the mouse enters a region.
 void mouseExited(MouseEvent e)
          Suppressed: Called when the mouse exits a region.
 void mouseMoved(MouseEvent e)
          Suppressed: Called when the mouse is moved.
 void mousePressed(MouseEvent e)
          Suppressed: If button 1 is pressed, this is implemented to request focus on the associated text component, and to set the caret position.
 void mouseReleased(MouseEvent e)
          Suppressed: Called when the mouse is released.
protected  void moveCaret(MouseEvent e)
          Tries to move the position of the caret from the coordinates of a mouse event, using viewToModel().
 void moveDot(int dot)
          Enabled: Moves the caret position to some other position.
(package private)  void moveDot(int dot, javax.swing.text.Position.Bias dotBias)
           
 void paint(Graphics g)
          Suppressed: Renders the caret as a vertical line.
protected  void positionCaret(MouseEvent e)
          Tries to set the position of the caret from the coordinates of a mouse event, using viewToModel().
private  void readObject(ObjectInputStream s)
           
 void removeChangeListener(ChangeListener l)
          Enabled: Removes a listener that was tracking caret position changes.
protected  void repaint()
          Cause the caret to be painted.
(package private)  void repaintNewCaret()
          Repaints the new caret position, with the assumption that this is happening on the event thread so that calling modelToView is safe.
(package private)  void setAsynchronousMovement(boolean m)
          Set the flag that determines whether or not asynchronous updates will move the caret.
 void setBlinkRate(int rate)
          Enabled: Sets the caret blink rate.
 void setDot(int dot)
          Enabled: Sets the caret position and mark to some position.
(package private)  void setDot(int dot, javax.swing.text.Position.Bias dotBias)
           
 void setMagicCaretPosition(Point p)
          Enabled: Saves the current caret position.
 void setSelectionVisible(boolean vis)
          Enabled: Changes the selection visibility.
 void setVisible(boolean e)
          Enabled: Sets the caret visibility, and repaints the caret.
 String toString()
          Suppressed:
private  void updateSystemSelection()
           
private  void writeObject(ObjectOutputStream s)
           
 
Methods inherited from class java.awt.Rectangle
add, add, add, contains, contains, contains, contains, createIntersection, createUnion, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, translate, union
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.Shape
contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects
 

Field Detail

listenerList

protected EventListenerList listenerList
The event listener list.


changeEvent

protected transient ChangeEvent changeEvent
The change event for the model. Only one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property. The source of events generated here is always "this".


component

JTextComponent component

async

boolean async
flag to indicate if async updates should move the caret.


visible

boolean visible

dot

int dot

mark

int mark

selectionTag

Object selectionTag

selectionVisible

boolean selectionVisible

flasher

Timer flasher

magicCaretPosition

Point magicCaretPosition

dotBias

transient javax.swing.text.Position.Bias dotBias

markBias

transient javax.swing.text.Position.Bias markBias

dotLTR

boolean dotLTR

markLTR

boolean markLTR

updateHandler

transient javax.swing.text.DefaultCaret.UpdateHandler updateHandler

flagXPoints

private transient int[] flagXPoints

flagYPoints

private transient int[] flagYPoints

focusListener

private transient FocusListener focusListener

filterBypass

private transient javax.swing.text.NavigationFilter.FilterBypass filterBypass

clipboardOwner

private transient ClipboardOwner clipboardOwner

ownsSelection

private boolean ownsSelection
This is used to indicate if the caret currently owns the selection. This is always false if the system does not support the system clipboard.


forceCaretPositionChange

private boolean forceCaretPositionChange
If this is true, the location of the dot is updated regardless of the current location. This is set in the DocumentListener such that even if the model location of dot hasn't changed (perhaps do to a forward delete) the visual location is updated.


shouldHandleRelease

private transient boolean shouldHandleRelease
Whether or not mouseReleased should adjust the caret and focus. This flag is set by mousePressed if it wanted to adjust the caret and focus but couldn't because of a possible DnD operation.

Constructor Detail

DefaultCaret

public DefaultCaret()
Enabled: Constructs a default caret.

Method Detail

getAsynchronousMovement

boolean getAsynchronousMovement()
Get the flag that determines whether or not asynchronous updates will move the caret. Normally the caret is moved by events from the event thread such as mouse or keyboard events. Changes from another thread might be used to load a file, or show changes from another user. This flag determines whether those changes will move the caret.


setAsynchronousMovement

void setAsynchronousMovement(boolean m)
Set the flag that determines whether or not asynchronous updates will move the caret. Normally the caret is moved by events from the event thread such as mouse or keyboard events. Changes from another thread might be used to load a file, or show changes from another user. This flag determines whether those changes will move the caret.

Parameters:
m - move the caret on asynchronous updates if true.

getComponent

protected final JTextComponent getComponent()
Gets the text editor component that this caret is is bound to.

Returns:
the component

repaint

protected final void repaint()
Cause the caret to be painted. The repaint area is the bounding box of the caret (i.e. the caret rectangle or this).

This method is thread safe, although most Swing methods are not. Please see Threads and Swing for more information.


damage

protected void damage(Rectangle r)
Damages the area surrounding the caret to cause it to be repainted in a new location. If paint() is reimplemented, this method should also be reimplemented. This method should update the caret bounds (x, y, width, and height).

Parameters:
r - the current location of the caret
See Also:
paint(java.awt.Graphics)

adjustVisibility

protected void adjustVisibility(Rectangle nloc)
Scrolls the associated view (if necessary) to make the caret visible. Since how this should be done is somewhat of a policy, this method can be reimplemented to change the behavior. By default the scrollRectToVisible method is called on the associated component.

Parameters:
nloc - the new position to scroll to

getSelectionPainter

protected javax.swing.text.Highlighter.HighlightPainter getSelectionPainter()
Gets the painter for the Highlighter.

Returns:
the painter

positionCaret

protected void positionCaret(MouseEvent e)
Tries to set the position of the caret from the coordinates of a mouse event, using viewToModel().

Parameters:
e - the mouse event

moveCaret

protected void moveCaret(MouseEvent e)
Tries to move the position of the caret from the coordinates of a mouse event, using viewToModel(). This will cause a selection if the dot and mark are different.

Parameters:
e - the mouse event

focusGained

public void focusGained(FocusEvent e)
Suppressed: Called when the component containing the caret gains focus. This is implemented to set the caret to visible if the component is editable.

Specified by:
focusGained in interface FocusListener
Parameters:
e - the focus event
See Also:
FocusListener.focusGained(java.awt.event.FocusEvent)

focusLost

public void focusLost(FocusEvent e)
Suppressed: Called when the component containing the caret loses focus. This is implemented to set the caret to visibility to false.

Specified by:
focusLost in interface FocusListener
Parameters:
e - the focus event
See Also:
FocusListener.focusLost(java.awt.event.FocusEvent)

mouseClicked

public void mouseClicked(MouseEvent e)
Suppressed: Called when the mouse is clicked. If the click was generated from button1, a double click selects a word, and a triple click the current line.

Specified by:
mouseClicked in interface MouseListener
Parameters:
e - the mouse event
See Also:
MouseListener.mouseClicked(java.awt.event.MouseEvent)

mousePressed

public void mousePressed(MouseEvent e)
Suppressed: If button 1 is pressed, this is implemented to request focus on the associated text component, and to set the caret position. If the shift key is held down, the caret will be moved, potentially resulting in a selection, otherwise the caret position will be set to the new location. If the component is not enabled, there will be no request for focus.

Specified by:
mousePressed in interface MouseListener
Parameters:
e - the mouse event
See Also:
MouseListener.mousePressed(java.awt.event.MouseEvent)

adjustCaretAndFocus

void adjustCaretAndFocus(MouseEvent e)

adjustCaret

private void adjustCaret(MouseEvent e)
Adjusts the caret location based on the MouseEvent.


adjustFocus

private void adjustFocus(boolean inWindow)
Adjusts the focus, if necessary.

Parameters:
inWindow - if true indicates requestFocusInWindow should be used

mouseReleased

public void mouseReleased(MouseEvent e)
Suppressed: Called when the mouse is released.

Specified by:
mouseReleased in interface MouseListener
Parameters:
e - the mouse event
See Also:
MouseListener.mouseReleased(java.awt.event.MouseEvent)

mouseEntered

public void mouseEntered(MouseEvent e)
Suppressed: Called when the mouse enters a region.

Specified by:
mouseEntered in interface MouseListener
Parameters:
e - the mouse event
See Also:
MouseListener.mouseEntered(java.awt.event.MouseEvent)

mouseExited

public void mouseExited(MouseEvent e)
Suppressed: Called when the mouse exits a region.

Specified by:
mouseExited in interface MouseListener
Parameters:
e - the mouse event
See Also:
MouseListener.mouseExited(java.awt.event.MouseEvent)

mouseDragged

public void mouseDragged(MouseEvent e)
Suppressed: Moves the caret position according to the mouse pointer's current location. This effectively extends the selection. By default, this is only done for mouse button 1.

Specified by:
mouseDragged in interface MouseMotionListener
Parameters:
e - the mouse event
See Also:
MouseMotionListener.mouseDragged(java.awt.event.MouseEvent)

mouseMoved

public void mouseMoved(MouseEvent e)
Suppressed: Called when the mouse is moved.

Specified by:
mouseMoved in interface MouseMotionListener
Parameters:
e - the mouse event
See Also:
MouseMotionListener.mouseMoved(java.awt.event.MouseEvent)

paint

public void paint(Graphics g)
Suppressed: Renders the caret as a vertical line. If this is reimplemented the damage method should also be reimplemented as it assumes the shape of the caret is a vertical line. Sets the caret color to the value returned by getCaretColor().

If there are multiple text directions present in the associated document, a flag indicating the caret bias will be rendered. This will occur only if the associated document is a subclass of AbstractDocument and there are multiple bidi levels present in the bidi element structure (i.e. the text has multiple directions associated with it).

Specified by:
paint in interface Caret
Parameters:
g - the graphics context
See Also:
damage(java.awt.Rectangle)

install

public void install(JTextComponent c)
Suppressed: 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. Sets the dot and mark to 0, and establishes document, property change, focus, mouse, and mouse motion listeners.

Specified by:
install in interface Caret
Parameters:
c - the component
See Also:
Caret.install(javax.swing.text.JTextComponent)

deinstall

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

Specified by:
deinstall in interface Caret
Parameters:
c - the component
See Also:
Caret.deinstall(javax.swing.text.JTextComponent)

addChangeListener

public void addChangeListener(ChangeListener l)
Enabled: Adds a listener to track whenever the caret position has been changed.

Specified by:
addChangeListener in interface Caret
Parameters:
l - the listener
See Also:
Caret.addChangeListener(javax.swing.event.ChangeListener)

removeChangeListener

public void removeChangeListener(ChangeListener l)
Enabled: Removes a listener that was tracking caret position changes.

Specified by:
removeChangeListener in interface Caret
Parameters:
l - the listener
See Also:
Caret.removeChangeListener(javax.swing.event.ChangeListener)

getChangeListeners

public ChangeListener[] getChangeListeners()
Suppressed: Returns an array of all the change listeners registered on this caret.

Returns:
all of this caret's ChangeListeners or an empty array if no change listeners are currently registered
Since:
1.4
See Also:
addChangeListener(javax.swing.event.ChangeListener), removeChangeListener(javax.swing.event.ChangeListener)

fireStateChanged

protected void fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method. The listener list is processed last to first.

See Also:
EventListenerList

getListeners

public EventListener[] getListeners(Class listenerType)
Suppressed: Returns an array of all the objects currently registered as FooListeners upon this caret. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal, such as FooListener.class. For example, you can query a DefaultCaret c for its change listeners with the following code:

ChangeListener[] cls = (ChangeListener[])(c.getListeners(ChangeListener.class));
If no such listeners exist, this method returns an empty array.

Parameters:
listenerType - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
Returns:
an array of all objects registered as FooListeners on this component, or an empty array if no such listeners have been added
Since:
1.3
See Also:
getChangeListeners()

setSelectionVisible

public void setSelectionVisible(boolean vis)
Enabled: Changes the selection visibility.

Specified by:
setSelectionVisible in interface Caret
Parameters:
vis - the new visibility

isSelectionVisible

public boolean isSelectionVisible()
Enabled: Checks whether the current selection is visible.

Specified by:
isSelectionVisible in interface Caret
Returns:
true if the selection is visible

isVisible

public boolean isVisible()
Enabled: Determines if the caret is currently visible.

Specified by:
isVisible in interface Caret
Returns:
true if visible else false
See Also:
Caret.isVisible()

setVisible

public void setVisible(boolean e)
Enabled: Sets the caret visibility, and repaints the caret.

Specified by:
setVisible in interface Caret
Parameters:
e - the visibility specifier
See Also:
Caret.setVisible(boolean)

setBlinkRate

public void setBlinkRate(int rate)
Enabled: Sets the caret blink rate.

Specified by:
setBlinkRate in interface Caret
Parameters:
rate - the rate in milliseconds, 0 to stop blinking
See Also:
Caret.setBlinkRate(int)

getBlinkRate

public int getBlinkRate()
Enabled: Gets the caret blink rate.

Specified by:
getBlinkRate in interface Caret
Returns:
the delay in milliseconds. If this is zero the caret will not blink.
See Also:
Caret.getBlinkRate()

getDot

public int getDot()
Enabled: Fetches the current position of the caret.

Specified by:
getDot in interface Caret
Returns:
the position >= 0
See Also:
Caret.getDot()

getMark

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

Specified by:
getMark in interface Caret
Returns:
the position >= 0
See Also:
Caret.getMark()

setDot

public void setDot(int dot)
Enabled: Sets the caret position and mark to some position. This implicitly sets the selection range to zero.

Specified by:
setDot in interface Caret
Parameters:
dot - the position >= 0
See Also:
Caret.setDot(int)

moveDot

public void moveDot(int dot)
Enabled: Moves the caret position to some other position.

Specified by:
moveDot in interface Caret
Parameters:
dot - the position >= 0
See Also:
Caret.moveDot(int)

moveDot

void moveDot(int dot,
             javax.swing.text.Position.Bias dotBias)

handleMoveDot

void handleMoveDot(int dot,
                   javax.swing.text.Position.Bias dotBias)

setDot

void setDot(int dot,
            javax.swing.text.Position.Bias dotBias)

handleSetDot

void handleSetDot(int dot,
                  javax.swing.text.Position.Bias dotBias)

getDotBias

javax.swing.text.Position.Bias getDotBias()

getMarkBias

javax.swing.text.Position.Bias getMarkBias()

isDotLeftToRight

boolean isDotLeftToRight()

isMarkLeftToRight

boolean isMarkLeftToRight()

isPositionLTR

boolean isPositionLTR(int position,
                      javax.swing.text.Position.Bias bias)

guessBiasForOffset

javax.swing.text.Position.Bias guessBiasForOffset(int offset,
                                                  javax.swing.text.Position.Bias lastBias,
                                                  boolean lastLTR)

changeCaretPosition

void changeCaretPosition(int dot,
                         javax.swing.text.Position.Bias dotBias)
Sets the caret position (dot) to a new location. This causes the old and new location to be repainted. It also makes sure that the caret is within the visible region of the view, if the view is scrollable.


repaintNewCaret

void repaintNewCaret()
Repaints the new caret position, with the assumption that this is happening on the event thread so that calling modelToView is safe.


updateSystemSelection

private void updateSystemSelection()

getSystemSelection

private Clipboard getSystemSelection()

getClipboardOwner

private ClipboardOwner getClipboardOwner()

ensureValidPosition

private void ensureValidPosition()
This is invoked after the document changes to verify the current dot/mark is valid. We do this in case the NavigationFilter changed where to position the dot, that resulted in the current location being bogus.


setMagicCaretPosition

public void setMagicCaretPosition(Point p)
Enabled: Saves the current caret position. This is used when caret up/down actions occur, moving between lines that have uneven end positions.

Specified by:
setMagicCaretPosition in interface Caret
Parameters:
p - the position
See Also:
getMagicCaretPosition()

getMagicCaretPosition

public Point getMagicCaretPosition()
Enabled: Gets the saved caret position.

Specified by:
getMagicCaretPosition in interface Caret
Returns:
the position see #setMagicCaretPosition
See Also:
Caret.setMagicCaretPosition(java.awt.Point)

equals

public boolean equals(Object obj)
Suppressed: Compares this object to the specified object. The superclass behavior of comparing rectangles is not desired, so this is changed to the Object behavior.

Overrides:
equals in class Rectangle
Parameters:
obj - the object to compare this font with
Returns:
true if the objects are equal; false otherwise

toString

public String toString()
Suppressed:

Overrides:
toString in class Rectangle
Returns:
a String representing this Rectangle object's coordinate and size values.

getFilterBypass

private javax.swing.text.NavigationFilter.FilterBypass getFilterBypass()

_contains

private boolean _contains(int X,
                          int Y,
                          int W,
                          int H)

readObject

private void readObject(ObjectInputStream s)
                 throws ClassNotFoundException,
                        IOException
ClassNotFoundException
IOException

writeObject

private void writeObject(ObjectOutputStream s)
                  throws IOException
IOException


comments?