Java JTextComponent Select focusSelect(final JTextComponent tf)

Here you can find the source of focusSelect(final JTextComponent tf)

Description

focus Select

License

Apache License

Declaration

public static void focusSelect(final JTextComponent tf) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;

import javax.swing.text.JTextComponent;

public class Main {
    public static void focusSelect(final JTextComponent tf) {
        tf.addFocusListener(new FocusAdapter() {
            public void focusGained(FocusEvent e) {
                tf.selectAll();/* w w  w.ja  va 2s  .co m*/
            }
        });
    }
}

Related

  1. addSelectAllTextOnFocus(final JTextComponent component)
  2. isSelectionUpperCase(JTextComponent textPane)
  3. replaceSelectionAndSelect(JTextComponent component, String text)
  4. selectAll(final JTextComponent textComponent)
  5. selectAll(JTextComponent textComponent)