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
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class Rectangle2D
Rectangle2D.Double, Rectangle2D.Float -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate intprivate intprivate booleanprivate booleanprivate booleanprivate booleanprivate static final Stringprivate static final intprivate static final intprivate final Stringprivate final booleanprivate booleanprivate booleanFields inherited from class DefaultCaret
ALWAYS_UPDATE, changeEvent, listenerList, NEVER_UPDATE, UPDATE_WHEN_ON_EDTFields inherited from class Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadjustVisibility(Rectangle nloc) voidvoidvoidprivate ObjectgetClientProperty(String key) private intvoidprivate booleanvoidvoidvoidvoidmoveDot(int dot) voidprivate voidselect(int mark, int dot) protected voidvoidsetDot(int dot) Methods inherited from class 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, paint, positionCaret, removeChangeListener, repaint, setBlinkRate, setDot, setMagicCaretPosition, setSelectionVisible, setUpdatePolicy, setVisible, toStringMethods inherited from class 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, unionMethods inherited from class Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, unionMethods inherited from class RectangularShape
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonalMethods inherited from interface Shape
contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects
-
Field Details
-
KEY_CARET_INFO
- See Also:
-
NEVER
private static final int NEVER- See Also:
-
ONCE
private static final int ONCE- See Also:
-
ALWAYS
private static final int ALWAYS- See Also:
-
selectAllOnFocusPolicy
-
selectAllOnMouseClick
private final boolean selectAllOnMouseClick -
inInstall
private boolean inInstall -
wasFocused
private boolean wasFocused -
wasFocusTemporaryLost
private boolean wasFocusTemporaryLost -
isMousePressed
private boolean isMousePressed -
isWordSelection
private boolean isWordSelection -
isLineSelection
private boolean isLineSelection -
dragSelectionStart
private int dragSelectionStart -
dragSelectionEnd
private int dragSelectionEnd
-
-
Constructor Details
-
FlatCaret
-
-
Method Details
-
install
- Specified by:
installin interfaceCaret- Overrides:
installin classDefaultCaret
-
deinstall
- Specified by:
deinstallin interfaceCaret- Overrides:
deinstallin classDefaultCaret
-
adjustVisibility
- Overrides:
adjustVisibilityin classDefaultCaret
-
setDot
public void setDot(int dot) - Specified by:
setDotin interfaceCaret- Overrides:
setDotin classDefaultCaret
-
moveDot
public void moveDot(int dot) - Specified by:
moveDotin interfaceCaret- Overrides:
moveDotin classDefaultCaret
-
focusGained
- Specified by:
focusGainedin interfaceFocusListener- Overrides:
focusGainedin classDefaultCaret
-
focusLost
- Specified by:
focusLostin interfaceFocusListener- Overrides:
focusLostin classDefaultCaret
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classDefaultCaret
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classDefaultCaret
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener- Overrides:
mouseDraggedin classDefaultCaret
-
selectAllOnFocusGained
protected void selectAllOnFocusGained() -
select
private void select(int mark, int dot) -
getSelectAllOnFocusPolicy
private int getSelectAllOnFocusPolicy() -
isSelectAllOnMouseClick
private boolean isSelectAllOnMouseClick() -
getClientProperty
-
scrollCaretToVisible
public void scrollCaretToVisible()- Since:
- 1.4
-