Terai Atsuhiro 2023-06-30 (金) 10:42:02

http://terai.xrea.jp/swing/selectall/screenshot.png

field1.addFocusListener(new FocusAdapter() {
  public void focusGained(FocusEvent e) {
    JTextField jtf = (JTextField)e.getSource();
    jtf.selectAll();
  }
});