javax.swing.text
Class JTextComponent.ComposedTextCaret

java.lang.Object
  extended byjava.awt.geom.RectangularShape
      extended byjava.awt.geom.Rectangle2D
          extended byjava.awt.Rectangle
              extended byjavax.swing.text.DefaultCaret
                  extended byjavax.swing.text.JTextComponent.ComposedTextCaret
All Implemented Interfaces:
Caret, Cloneable, EventListener, FocusListener, MouseListener, MouseMotionListener, Serializable, Shape
Enclosing class:
JTextComponent

class JTextComponent.ComposedTextCaret
extends DefaultCaret
implements Serializable


Nested Class Summary
 
Nested classes inherited from class javax.swing.text.DefaultCaret
DefaultCaret.SafeScroller, DefaultCaret.UpdateHandler
 
Nested classes inherited from class java.awt.geom.Rectangle2D
Rectangle2D.Double, Rectangle2D.Float
 
Field Summary
(package private)  Color bg
           
 
Fields inherited from class javax.swing.text.DefaultCaret
async, changeEvent, component, dot, dotBias, dotLTR, flasher, listenerList, magicCaretPosition, mark, markBias, markLTR, selectionTag, selectionVisible, updateHandler, visible
 
Fields inherited from class java.awt.Rectangle
height, width, x, y
 
Fields inherited from class java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
 
Constructor Summary
(package private) JTextComponent.ComposedTextCaret()
           
 
Method Summary
 void install(JTextComponent c)
          Called when the UI is being installed into the interface of a JTextComponent.
 void paint(Graphics g)
          Renders the caret as a vertical line.
protected  void positionCaret(MouseEvent me)
          Tries to set the position of the caret from the coordinates of a mouse event, using viewToModel().
 
Methods inherited from class javax.swing.text.DefaultCaret
addChangeListener, adjustCaretAndFocus, adjustVisibility, changeCaretPosition, damage, deinstall, equals, fireStateChanged, focusGained, focusLost, getAsynchronousMovement, getBlinkRate, getChangeListeners, getComponent, getDot, getDotBias, getListeners, getMagicCaretPosition, getMark, getMarkBias, getSelectionPainter, guessBiasForOffset, handleMoveDot, handleSetDot, isDotLeftToRight, isMarkLeftToRight, isPositionLTR, isSelectionVisible, isVisible, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, moveCaret, moveDot, moveDot, removeChangeListener, repaint, repaintNewCaret, setAsynchronousMovement, setBlinkRate, setDot, setDot, setMagicCaretPosition, setSelectionVisible, setVisible, toString
 
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.awt.geom.Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.Shape
contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects
 

Field Detail

bg

Color bg
Constructor Detail

JTextComponent.ComposedTextCaret

JTextComponent.ComposedTextCaret()
Method Detail

install

public void install(JTextComponent c)
Description copied from class: DefaultCaret
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
Overrides:
install in class DefaultCaret
Parameters:
c - the component
See Also:
Caret.install(javax.swing.text.JTextComponent)

paint

public void paint(Graphics g)
Description copied from class: DefaultCaret
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
Overrides:
paint in class DefaultCaret
Parameters:
g - the graphics context
See Also:
DefaultCaret.damage(java.awt.Rectangle)

positionCaret

protected void positionCaret(MouseEvent me)
Description copied from class: DefaultCaret
Tries to set the position of the caret from the coordinates of a mouse event, using viewToModel().

Overrides:
positionCaret in class DefaultCaret
Parameters:
me - the mouse event