@Override
	public void mousePressed( MouseEvent e ) {
		isMousePressed = true;
		super.mousePressed( e );

		JTextComponent c = getComponent();

		// left double-click starts word selection
		isWordSelection = e.getClickCount() == 2 && SwingUtilities.isLeftMouseButton( e ) && !e.isConsumed();

		// left triple-click starts line selection
		isLineSelection = e.getClickCount() == 3 && SwingUtilities.isLeftMouseButton( e ) && (!e.isConsumed() || c.getDragEnabled());

		// select line
		// (this is also done in DefaultCaret.mouseClicked(), but this event is
		// sent when the mouse is released, which is too late for triple-click-and-drag)
		if( isLineSelection ) {
			ActionMap actionMap = c.getActionMap();
			Action selectLineAction = (actionMap != null)
				? actionMap.get( DefaultEditorKit.selectLineAction )
				: null;
			if( selectLineAction != null ) {
				selectLineAction.actionPerformed( new ActionEvent( c,
					ActionEvent.ACTION_PERFORMED, null, e.getWhen(), e.getModifiers() ) );
			}
		}

		// remember selection where word/line selection starts to keep it always selected while dragging
		if( isWordSelection || isLineSelection ) {
			int mark = getMark();
			int dot = getDot();
			dragSelectionStart = Math.min( dot, mark );
			dragSelectionEnd = Math.max( dot, mark );
		}
	}
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.

@author Karl Tauber
flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatCaret.java