protected void selectAllOnFocusGained() {
		JTextComponent c = getComponent();
		Document doc = c.getDocument();
		if( doc == null || !c.isEnabled() || !c.isEditable() || FlatUIUtils.isCellEditor( c ) )
			return;

		int selectAllOnFocusPolicy = getSelectAllOnFocusPolicy();
		if( selectAllOnFocusPolicy == NEVER )
			return;

		if( selectAllOnFocusPolicy == ONCE && !isMousePressed ) {
			// was already focused?
			if( wasFocused && !(c instanceof JFormattedTextField) )
				return;
		}

		// select all
		if( c instanceof JFormattedTextField ) {
			EventQueue.invokeLater( () -> {
				// Warning: do not use variables from outside of this runnable
				//          because they may be out-of-date when this runnable is executed

				JTextComponent c2 = getComponent();
				if( c2 == null )
					return; // was deinstalled

				select( 0, c2.getDocument().getLength() );
			} );
		} else
			select( 0, doc.getLength() );
	}
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