com.raelity.jvi.swing
Class DefaultViCaret
java.lang.Object
java.awt.geom.RectangularShape
java.awt.geom.Rectangle2D
java.awt.Rectangle
javax.swing.text.DefaultCaret
com.raelity.jvi.swing.DefaultViCaret
- All Implemented Interfaces:
- ViCaret, FocusListener, MouseListener, MouseMotionListener, Shape, Serializable, Cloneable, EventListener, Caret
public class DefaultViCaret
- extends DefaultCaret
- implements ViCaret
This extension of DefaultCaret
draws the
caret in different ways as defined by the cursor property.
// NEEDSWORK: cache the current font metric, listen to font property changes
- See Also:
- Serialized Form
Methods inherited from class javax.swing.text.DefaultCaret |
addChangeListener, deinstall, equals, fireStateChanged, focusGained, focusLost, getBlinkRate, getChangeListeners, getComponent, getDot, getListeners, getMagicCaretPosition, getMark, getSelectionPainter, getUpdatePolicy, install, isActive, isSelectionVisible, isVisible, mouseEntered, mouseExited, mouseMoved, moveCaret, positionCaret, removeChangeListener, repaint, setBlinkRate, setMagicCaretPosition, setSelectionVisible, setUpdatePolicy, 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 interface javax.swing.text.Caret |
addChangeListener, deinstall, getBlinkRate, getDot, getMagicCaretPosition, getMark, install, isSelectionVisible, isVisible, removeChangeListener, setBlinkRate, setMagicCaretPosition, setSelectionVisible, setVisible |
DefaultViCaret
public DefaultViCaret()
setCursor
public void setCursor(ViCursor cursor)
- Specified by:
setCursor
in interface ViCaret
getCursor
public ViCursor getCursor()
- Specified by:
getCursor
in interface ViCaret
damage
protected void damage(Rectangle r)
- Overrides:
damage
in class DefaultCaret
adjustVisibility
protected void adjustVisibility(Rectangle nloc)
- Overrides:
adjustVisibility
in class DefaultCaret
paint
public void paint(Graphics g)
- Render the caret as specified by the cursor.
Note: might want to check editor manager, and if not vi then
call super(paint), same for super(damage)
- Specified by:
paint
in interface Caret
- Overrides:
paint
in class DefaultCaret
getTextComponent
public JTextComponent getTextComponent()
- Specified by:
getTextComponent
in interface ViCaret
setDot
public void setDot(int dot)
- Tries to set the position of the caret from
the coordinates of a mouse event, using viewToModel().
Notifies vi that the most has been clicked in window
and give vi a chance to adjust the position.
- Specified by:
setDot
in interface Caret
- Overrides:
setDot
in class DefaultCaret
- Parameters:
e
- the mouse event
setDot
public void setDot(int dot,
Position.Bias dotBias)
moveDot
public void moveDot(int dot)
- Specified by:
moveDot
in interface Caret
- Overrides:
moveDot
in class DefaultCaret
moveDot
public void moveDot(int dot,
Position.Bias dotBias)
mousePressed
public void mousePressed(MouseEvent mouseEvent)
- Specified by:
mousePressed
in interface MouseListener
- Overrides:
mousePressed
in class DefaultCaret
mouseReleased
public void mouseReleased(MouseEvent mouseEvent)
- Specified by:
mouseReleased
in interface MouseListener
- Overrides:
mouseReleased
in class DefaultCaret
mouseClicked
public void mouseClicked(MouseEvent mouseEvent)
- Specified by:
mouseClicked
in interface MouseListener
- Overrides:
mouseClicked
in class DefaultCaret
mouseDragged
public void mouseDragged(MouseEvent mouseEvent)
- Specified by:
mouseDragged
in interface MouseMotionListener
- Overrides:
mouseDragged
in class DefaultCaret