Package com.formdev.flatlaf.ui
Class FlatCaret
- java.lang.Object
-
- java.awt.geom.RectangularShape
-
- java.awt.geom.Rectangle2D
-
- java.awt.Rectangle
-
- javax.swing.text.DefaultCaret
-
- com.formdev.flatlaf.ui.FlatCaret
-
- All Implemented Interfaces:
FocusListener,MouseListener,MouseMotionListener,Shape,Serializable,Cloneable,EventListener,UIResource,Caret
public class FlatCaret extends DefaultCaret implements UIResource
Caret that can select all text on focus gained. Also fixes Swing's double-click-and-drag behavior so that dragging after a double-click extends selection by whole words.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
Rectangle2D.Double, Rectangle2D.Float
-
-
Field Summary
-
Fields inherited from class javax.swing.text.DefaultCaret
ALWAYS_UPDATE, changeEvent, listenerList, NEVER_UPDATE, UPDATE_WHEN_ON_EDT
-
Fields inherited from class java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidadjustVisibility(Rectangle nloc)voiddeinstall(JTextComponent c)voidfocusGained(FocusEvent e)voidfocusLost(FocusEvent e)voidinstall(JTextComponent c)voidmouseDragged(MouseEvent e)voidmousePressed(MouseEvent e)voidmouseReleased(MouseEvent e)voidscrollCaretToVisible()protected voidselectAllOnFocusGained()-
Methods inherited from class javax.swing.text.DefaultCaret
addChangeListener, damage, equals, fireStateChanged, getBlinkRate, getChangeListeners, getComponent, getDot, getDotBias, getListeners, getMagicCaretPosition, getMark, getMarkBias, getSelectionPainter, getUpdatePolicy, isActive, isSelectionVisible, isVisible, mouseClicked, mouseEntered, mouseExited, mouseMoved, moveCaret, moveDot, moveDot, paint, positionCaret, removeChangeListener, repaint, setBlinkRate, setDot, setDot, 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 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
-
-
-
-
Constructor Detail
-
FlatCaret
public FlatCaret(String selectAllOnFocusPolicy, boolean selectAllOnMouseClick)
-
-
Method Detail
-
install
public void install(JTextComponent c)
- Specified by:
installin interfaceCaret- Overrides:
installin classDefaultCaret
-
deinstall
public void deinstall(JTextComponent c)
- Specified by:
deinstallin interfaceCaret- Overrides:
deinstallin classDefaultCaret
-
adjustVisibility
protected void adjustVisibility(Rectangle nloc)
- Overrides:
adjustVisibilityin classDefaultCaret
-
focusGained
public void focusGained(FocusEvent e)
- Specified by:
focusGainedin interfaceFocusListener- Overrides:
focusGainedin classDefaultCaret
-
focusLost
public void focusLost(FocusEvent e)
- Specified by:
focusLostin interfaceFocusListener- Overrides:
focusLostin classDefaultCaret
-
mousePressed
public void mousePressed(MouseEvent e)
- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classDefaultCaret
-
mouseReleased
public void mouseReleased(MouseEvent e)
- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classDefaultCaret
-
mouseDragged
public void mouseDragged(MouseEvent e)
- Specified by:
mouseDraggedin interfaceMouseMotionListener- Overrides:
mouseDraggedin classDefaultCaret
-
selectAllOnFocusGained
protected void selectAllOnFocusGained()
-
scrollCaretToVisible
public void scrollCaretToVisible()
- Since:
- 1.4
-
-