Terai Atsuhiro 2023-11-24 (金) 16:02:25

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

ActionMap am = field.getActionMap();
Action beep = new DefaultEditorKit.BeepAction();
am.put(DefaultEditorKit.cutAction,   beep);
am.put(DefaultEditorKit.copyAction,  beep);
am.put(DefaultEditorKit.pasteAction, beep);
field.setActionMap(am);
JTextField field = new JTextField() {
  public void copy() {
    java.awt.Toolkit.getDefaultToolkit().beep();
  }
};