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
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 java.awt.geom.Rectangle2D
Rectangle2D.Double, Rectangle2D.Float
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private int
private boolean
private boolean
private boolean
private boolean
private static final String
private final String
private final boolean
private boolean
private boolean
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
adjustVisibility
(Rectangle nloc) void
void
void
void
void
void
void
void
private void
select
(int mark, int dot) protected void
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
-
Field Details
-
KEY_CARET_INFO
- See Also:
-
selectAllOnFocusPolicy
-
selectAllOnMouseClick
private final boolean selectAllOnMouseClick -
inInstall
private boolean inInstall -
wasFocused
private boolean wasFocused -
wasTemporaryLost
private boolean wasTemporaryLost -
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:
install
in interfaceCaret
- Overrides:
install
in classDefaultCaret
-
deinstall
- Specified by:
deinstall
in interfaceCaret
- Overrides:
deinstall
in classDefaultCaret
-
adjustVisibility
- Overrides:
adjustVisibility
in classDefaultCaret
-
focusGained
- Specified by:
focusGained
in interfaceFocusListener
- Overrides:
focusGained
in classDefaultCaret
-
focusLost
- Specified by:
focusLost
in interfaceFocusListener
- Overrides:
focusLost
in classDefaultCaret
-
mousePressed
- Specified by:
mousePressed
in interfaceMouseListener
- Overrides:
mousePressed
in classDefaultCaret
-
mouseReleased
- Specified by:
mouseReleased
in interfaceMouseListener
- Overrides:
mouseReleased
in classDefaultCaret
-
mouseDragged
- Specified by:
mouseDragged
in interfaceMouseMotionListener
- Overrides:
mouseDragged
in classDefaultCaret
-
selectAllOnFocusGained
protected void selectAllOnFocusGained() -
select
private void select(int mark, int dot) -
scrollCaretToVisible
public void scrollCaretToVisible()- Since:
- 1.4
-