@Override public void focusGained(final FocusEvent e) { final JTextComponent component = getComponent(); if (!component.isEnabled() || !component.isEditable()) { super.focusGained(e); return; } mFocused = true; if (!shouldSelectAllOnFocus) { shouldSelectAllOnFocus = true; super.focusGained(e); return; } if (isMultiLineEditor) { super.focusGained(e); return; } final int end = component.getDocument().getLength(); final int dot = getDot(); final int mark = getMark(); if (dot == mark) { if (dot == 0) { component.setCaretPosition(end); component.moveCaretPosition(0); } else if (dot == end) { component.setCaretPosition(0); component.moveCaretPosition(end); } } super.focusGained(e); }
public void focusGained(FocusEvent e) { inModalMode = true; if (debug) System.out.println("gained focus"); setBlinkRate(500); // setCaretValue(caretValue); super.focusGained(e); }