Terai Atsuhiro 2021-09-19 (日) 10:55:00

JDialog says ESC key is already registered--where?


  public void actionPerformed(ActionEvent evt){
    dialog.dispose();
  }
};
InputMap imap = dialog.getRootPane().getInputMap();
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "close-it");
dialog.getRootPane().getActionMap().put("close-it", act);