API Overview API Index Package Overview Direct link to this page
JDK 1.6
  javax.swing.text. DefaultCaret View Source
Author(s)
Timothy Prinzing
Since
Version
1.148 11/30/06
Serial
Hierarchy
 Object
      RectangularShape
          Rectangle2D
              Rectangle
                  DefaultCaret
Implements
 Caret
 FocusListener
 MouseListener
 MouseMotionListener
Subclasses
Description
public class DefaultCaret
  A default implementation of Caret.
See also:    Caret
Constructors
public DefaultCaret ()
Constructs a default caret.
Methods
Hide/Show inherited methods
public void add (double newx, double newy) [Inherited From Rectangle2D]
  Adds a point, specified by the double precision arguments newx and newy, to this Rectangle2D.
public void add (int newx, int newy) [Inherited From Rectangle]
  Adds a point, specified by the integer arguments newx,newy to the bounds of this Rectangle.
public void add (Point pt) [Inherited From Rectangle]
  Adds the specified Point to the bounds of this Rectangle.
public void add (Point2D pt) [Inherited From Rectangle2D]
  Adds the Point2D object pt to this Rectangle2D.
public void add (Rectangle r) [Inherited From Rectangle]
  Adds a Rectangle to this Rectangle.
public void add (Rectangle2D r) [Inherited From Rectangle2D]
  Adds a Rectangle2D object to this Rectangle2D.
public void addChangeListener (ChangeListener l) [Specified in Caret]
  Adds a listener to track whenever the caret position has been changed.
pack-private void adjustCaretAndFocus (MouseEvent e)
protected void adjustVisibility (Rectangle nloc)
  Scrolls the associated view (if necessary) to make the caret visible.
pack-private void changeCaretPosition (int dot, Bias dotBias)
  Sets the caret position (dot) to a new location.
public Object clone () [Inherited From RectangularShape]
  Creates a new object of the same class and with the same contents as this object.
public boolean contains (double x, double y) [Inherited From Rectangle2D]
  Tests if the specified coordinates are inside the boundary of the Shape.
public boolean contains (double x, double y, double w, double h) [Inherited From Rectangle2D]
  Tests if the interior of the Shape entirely contains the specified rectangular area.
public boolean contains (int x, int y) [Inherited From Rectangle]
  Checks whether or not this Rectangle contains the point at the specified location (x,y).
public boolean contains (int X, int Y, int W, int H) [Inherited From Rectangle]
  Checks whether this Rectangle entirely contains the Rectangle at the specified location (X,Y) with the specified dimensions (W,H).
public boolean contains (Point p) [Inherited From Rectangle]
  Checks whether or not this Rectangle contains the specified Point.
public boolean contains (Point2D p) [Inherited From RectangularShape]
  Tests if a specified Point2D is inside the boundary of the Shape.
public boolean contains (Rectangle r) [Inherited From Rectangle]
  Checks whether or not this Rectangle entirely contains the specified Rectangle.
public boolean contains (Rectangle2D r) [Inherited From RectangularShape]
  Tests if the interior of the Shape entirely contains the specified Rectangle2D.
public Rectangle2D createIntersection (Rectangle2D r) [Inherited From Rectangle] [Specified in Rectangle2D]
  Returns a new Rectangle2D object representing the intersection of this Rectangle2D with the specified Rectangle2D.
public Rectangle2D createUnion (Rectangle2D r) [Inherited From Rectangle] [Specified in Rectangle2D]
  Returns a new Rectangle2D object representing the union of this Rectangle2D with the specified Rectangle2D.
protectedsynchronized void damage (Rectangle r)
  Damages the area surrounding the caret to cause it to be repainted in a new location.
public void deinstall (JTextComponent c) [Specified in Caret]
  Called when the UI is being removed from the interface of a JTextComponent.
public boolean equals (Object obj) [Overrides Rectangle]
  Compares this object to the specified object.
protected void fireStateChanged ()
  Notifies all listeners that have registered interest for notification on this event type.
public void focusGained (FocusEvent e) [Specified in FocusListener]
  Called when the component containing the caret gains focus.
public void focusLost (FocusEvent e) [Specified in FocusListener]
  Called when the component containing the caret loses focus.
public int getBlinkRate () [Specified in Caret]
  Gets the caret blink rate.
public Rectangle getBounds () [Inherited From Rectangle]
  Gets the bounding Rectangle of this Rectangle.
public Rectangle2D getBounds2D () [Inherited From Rectangle]
  Returns a high precision and more accurate bounding box of the Shape than the getBounds method. Note that there is no guarantee that the returned Rectangle2D is the smallest bounding box that encloses the Shape, only that the Shape lies entirely within the indicated Rectangle2D. The bounding box returned by this method is usually tighter than that returned by the getBounds method and never fails due to overflow problems since the return value can be an instance of the Rectangle2D that uses double precision values to store the dimensions.
pack-private int getCaretWidth (int height)
public double getCenterX () [Inherited From RectangularShape]
  Returns the X coordinate of the center of the framing rectangle of the Shape in double precision.
public double getCenterY () [Inherited From RectangularShape]
  Returns the Y coordinate of the center of the framing rectangle of the Shape in double precision.
public ChangeListener getChangeListeners ()
  Returns an array of all the change listeners registered on this caret.
protectedfinal JTextComponent getComponent ()
  Gets the text editor component that this caret is is bound to.
public int getDot () [Specified in Caret]
  Fetches the current position of the caret.
public Bias getDotBias ()
  Returns the bias of the caret position.
public Rectangle2D getFrame () [Inherited From RectangularShape]
  Returns the framing Rectangle2D that defines the overall shape of this object.
public double getHeight () [Inherited From Rectangle] [Specified in RectangularShape]
  Returns the height of the bounding Rectangle in double precision.
public T getListeners (Class< T> listenerType)
  Returns an array of all the objects currently registered as FooListeners upon this caret.
public Point getLocation () [Inherited From Rectangle]
  Returns the location of this Rectangle.
public Point getMagicCaretPosition () [Specified in Caret]
  Gets the saved caret position.
public int getMark () [Specified in Caret]
  Fetches the current position of the mark.
public Bias getMarkBias ()
  Returns the bias of the mark.
public double getMaxX () [Inherited From RectangularShape]
  Returns the largest X coordinate of the framing rectangle of the Shape in double precision.
public double getMaxY () [Inherited From RectangularShape]
  Returns the largest Y coordinate of the framing rectangle of the Shape in double precision.
public double getMinX () [Inherited From RectangularShape]
  Returns the smallest X coordinate of the framing rectangle of the Shape in double precision.
public double getMinY () [Inherited From RectangularShape]
  Returns the smallest Y coordinate of the framing rectangle of the Shape in double precision.
public PathIterator getPathIterator (AffineTransform at) [Inherited From Rectangle2D]
  Returns an iteration object that defines the boundary of this Rectangle2D.
public PathIterator getPathIterator (AffineTransform at, double flatness) [Inherited From Rectangle2D]
  Returns an iteration object that defines the boundary of the flattened Rectangle2D.
protected HighlightPainter getSelectionPainter ()
  Gets the painter for the Highlighter.
public Dimension getSize () [Inherited From Rectangle]
  Gets the size of this Rectangle, represented by the returned Dimension.
public int getUpdatePolicy ()
  Gets the caret movement policy on document updates.
public double getWidth () [Inherited From Rectangle] [Specified in RectangularShape]
  Returns the width of the bounding Rectangle in double precision.
public double getX () [Inherited From Rectangle] [Specified in RectangularShape]
  Returns the X coordinate of the bounding Rectangle in double precision.
public double getY () [Inherited From Rectangle] [Specified in RectangularShape]
  Returns the Y coordinate of the bounding Rectangle in double precision.
public void grow (int h, int v) [Inherited From Rectangle]
  Resizes the Rectangle both horizontally and vertically.
pack-private Bias guessBiasForOffset (int offset, Bias lastBias, boolean lastLTR)
pack-private void handleMoveDot (int dot, Bias dotBias)
pack-private void handleSetDot (int dot, Bias dotBias)
public int hashCode () [Inherited From Rectangle2D]
  Returns the hashcode for this Rectangle2D.
@Deprecated
public boolean inside (int X, int Y) [Inherited From Rectangle]
  Checks whether or not this Rectangle contains the point at the specified location (X,Y).
public void install (JTextComponent c) [Specified in Caret]
  Called when the UI is being installed into the interface of a JTextComponent.
publicstatic void intersect (Rectangle2D src1, Rectangle2D src2, Rectangle2D dest) [Inherited From Rectangle2D]
  Intersects the pair of specified source Rectangle2D objects and puts the result into the specified destination Rectangle2D object.
public Rectangle intersection (Rectangle r) [Inherited From Rectangle]
  Computes the intersection of this Rectangle with the specified Rectangle.
public boolean intersects (double x, double y, double w, double h) [Inherited From Rectangle2D]
  Tests if the interior of the Shape intersects the interior of a specified rectangular area.
public boolean intersects (Rectangle r) [Inherited From Rectangle]
  Determines whether or not this Rectangle and the specified Rectangle intersect.
public boolean intersects (Rectangle2D r) [Inherited From RectangularShape]
  Tests if the interior of the Shape intersects the interior of a specified Rectangle2D.
public boolean intersectsLine (double x1, double y1, double x2, double y2) [Inherited From Rectangle2D]
  Tests if the specified line segment intersects the interior of this Rectangle2D.
public boolean intersectsLine (Line2D l) [Inherited From Rectangle2D]
  Tests if the specified line segment intersects the interior of this Rectangle2D.
public boolean isActive ()
  Determines if the caret is currently active.
pack-private boolean isDotLeftToRight ()
public boolean isEmpty () [Inherited From Rectangle] [Specified in RectangularShape]
  Determines whether the RectangularShape is empty.
pack-private boolean isMarkLeftToRight ()
pack-private boolean isPositionLTR (int position, Bias bias)
public boolean isSelectionVisible () [Specified in Caret]
  Checks whether the current selection is visible.
public boolean isVisible () [Specified in Caret]
  Indicates whether or not the caret is currently visible.
public void mouseClicked (MouseEvent e) [Specified in MouseListener]
  Called when the mouse is clicked.
public void mouseDragged (MouseEvent e) [Specified in MouseMotionListener]
  Moves the caret position according to the mouse pointer's current location.
public void mouseEntered (MouseEvent e) [Specified in MouseListener]
  Called when the mouse enters a region.
public void mouseExited (MouseEvent e) [Specified in MouseListener]
  Called when the mouse exits a region.
public void mouseMoved (MouseEvent e) [Specified in MouseMotionListener]
  Called when the mouse is moved.
public void mousePressed (MouseEvent e) [Specified in MouseListener]
  If button 1 is pressed, this is implemented to request focus on the associated text component, and to set the caret position.
public void mouseReleased (MouseEvent e) [Specified in MouseListener]
  Called when the mouse is released.
@Deprecated
public void move (int x, int y) [Inherited From Rectangle]
  Moves this Rectangle to the specified location.
protected void moveCaret (MouseEvent e)
  Tries to move the position of the caret from the coordinates of a mouse event, using viewToModel().
public void moveDot (int dot) [Specified in Caret]
  Moves the caret position to the specified position, with a forward bias.
public void moveDot (int dot, Bias dotBias)
  Moves the caret position to the specified position, with the specified bias.
public int outcode (double x, double y) [Inherited From Rectangle] [Specified in Rectangle2D]
  Determines where the specified coordinates lie with respect to this Rectangle2D.
public int outcode (Point2D p) [Inherited From Rectangle2D]
  Determines where the specified Point2D lies with respect to this Rectangle2D.
public void paint (Graphics g) [Specified in Caret]
  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().
public void removeChangeListener (ChangeListener l) [Specified in Caret]
  Removes a listener that was tracking caret position changes.
protectedfinalsynchronized void repaint ()
  Cause the caret to be painted.
pack-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.
@Deprecated
public void reshape (int x, int y, int width, int height) [Inherited From Rectangle]
  Sets the bounding Rectangle of this Rectangle to the specified x, y, width, and height.
@Deprecated
public void resize (int width, int height) [Inherited From Rectangle]
  Sets the size of this Rectangle to the specified width and height.
public void setBlinkRate (int rate) [Specified in Caret]
  Sets the caret blink rate.
public void setBounds (int x, int y, int width, int height) [Inherited From Rectangle]
  Sets the bounding Rectangle of this Rectangle to the specified x, y, width, and height.
public void setBounds (Rectangle r) [Inherited From Rectangle]
  Sets the bounding Rectangle of this Rectangle to match the specified Rectangle.
public void setDot (int dot) [Specified in Caret]
  Sets the caret position and mark to the specified position, with a forward bias.
public void setDot (int dot, Bias dotBias)
  Sets the caret position and mark to the specified position, with the specified bias.
public void setFrame (double x, double y, double w, double h) [Inherited From Rectangle2D] [Specified in RectangularShape]
  Sets the location and size of the outer bounds of this Rectangle2D to the specified rectangular values.
public void setFrame (Point2D loc, Dimension2D size) [Inherited From RectangularShape]
  Sets the location and size of the framing rectangle of this Shape to the specified Point2D and Dimension2D, respectively.
public void setFrame (Rectangle2D r) [Inherited From RectangularShape]
  Sets the framing rectangle of this Shape to be the specified Rectangle2D.
public void setFrameFromCenter (double centerX, double centerY, double cornerX, double cornerY) [Inherited From RectangularShape]
  Sets the framing rectangle of this Shape based on the specified center point coordinates and corner point coordinates.
public void setFrameFromCenter (Point2D center, Point2D corner) [Inherited From RectangularShape]
  Sets the framing rectangle of this Shape based on a specified center Point2D and corner Point2D.
public void setFrameFromDiagonal (double x1, double y1, double x2, double y2) [Inherited From RectangularShape]
  Sets the diagonal of the framing rectangle of this Shape based on the two specified coordinates.
public void setFrameFromDiagonal (Point2D p1, Point2D p2) [Inherited From RectangularShape]
  Sets the diagonal of the framing rectangle of this Shape based on two specified Point2D objects.
public void setLocation (int x, int y) [Inherited From Rectangle]
  Moves this Rectangle to the specified location.
public void setLocation (Point p) [Inherited From Rectangle]
  Moves this Rectangle to the specified location.
public void setMagicCaretPosition (Point p) [Specified in Caret]
  Saves the current caret position.
public void setRect (double x, double y, double width, double height) [Inherited From Rectangle] [Specified in Rectangle2D]
  Sets the bounds of this Rectangle to the integer bounds which encompass the specified x, y, width, and height.
public void setRect (Rectangle2D r) [Inherited From Rectangle2D]
  Sets this Rectangle2D to be the same as the specified Rectangle2D.
public void setSelectionVisible (boolean vis) [Specified in Caret]
  Changes the selection visibility.
public void setSize (Dimension d) [Inherited From Rectangle]
  Sets the size of this Rectangle to match the specified Dimension.
public void setSize (int width, int height) [Inherited From Rectangle]
  Sets the size of this Rectangle to the specified width and height.
public void setUpdatePolicy (int policy)
  Sets the caret movement policy on the document updates.
public void setVisible (boolean e) [Specified in Caret]
  Sets the caret visibility, and repaints the caret.
public String toString () [Overrides Rectangle]
public void translate (int dx, int dy) [Inherited From Rectangle]
  Translates this Rectangle the indicated distance, to the right along the X coordinate axis, and downward along the Y coordinate axis.
public Rectangle union (Rectangle r) [Inherited From Rectangle]
  Computes the union of this Rectangle with the specified Rectangle.
publicstatic void union (Rectangle2D src1, Rectangle2D src2, Rectangle2D dest) [Inherited From Rectangle2D]
  Unions the pair of source Rectangle2D objects and puts the result into the specified destination Rectangle2D object.
Fields
Hide/Show inherited fields
pack-private boolean active
publicfinalstatic int ALWAYS_UPDATE = "2"
  Indicates that the caret position is to be always updated accordingly to the document changes regardless whether the document updates are performed on the Event Dispatching Thread or not.
protectedtransient ChangeEvent changeEvent
  The change event for the model.
pack-private JTextComponent component
pack-private int dot
pack-privatetransient Bias dotBias
pack-private boolean dotLTR
pack-private Timer flasher
pack-privatetransient Handler handler
public int height [Inherited From Rectangle]
  The height of the Rectangle.
protected EventListenerList listenerList
The event listener list.
pack-private Point magicCaretPosition
pack-private int mark
pack-privatetransient Bias markBias
pack-private boolean markLTR
publicfinalstatic int NEVER_UPDATE = "1"
  Indicates that the caret should remain at the same absolute position in the document regardless of any document updates, except when the document length becomes less than the current caret position due to removal.
publicfinalstatic int OUT_BOTTOM = "8" [Inherited From Rectangle2D]
  The bitmask that indicates that a point lies below this Rectangle2D.
publicfinalstatic int OUT_LEFT = "1" [Inherited From Rectangle2D]
  The bitmask that indicates that a point lies to the left of this Rectangle2D.
publicfinalstatic int OUT_RIGHT = "4" [Inherited From Rectangle2D]
  The bitmask that indicates that a point lies to the right of this Rectangle2D.
publicfinalstatic int OUT_TOP = "2" [Inherited From Rectangle2D]
  The bitmask that indicates that a point lies above this Rectangle2D.
pack-private Object selectionTag
pack-private boolean selectionVisible
publicfinalstatic int UPDATE_WHEN_ON_EDT = "0"
  Indicates that the caret position is to be updated only when document changes are performed on the Event Dispatching Thread.
pack-private int updatePolicy
pack-private boolean visible
public int width [Inherited From Rectangle]
  The width of the Rectangle.
public int x [Inherited From Rectangle]
  The X coordinate of the upper-left corner of the Rectangle.
public int y [Inherited From Rectangle]
  The Y coordinate of the upper-left corner of the Rectangle.
Nested Classes
  DefaultCaret.SafeScroller
  DefaultCaret.Handler
  Rectangle2D.Float
The Float class defines a rectangle specified in float coordinates.
  Rectangle2D.Double
The Double class defines a rectangle specified in double coordinates.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar