mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-27 15:03:21 -04:00
You can close the attribute dialog with the ESC key.
This commit is contained in:
parent
ebd7df3851
commit
c2fd3c65b5
@ -10,6 +10,7 @@ import de.neemann.gui.ToolTipAction;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,6 +24,7 @@ import java.util.ArrayList;
|
|||||||
* @author hneemann
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public class AttributeDialog extends JDialog {
|
public class AttributeDialog extends JDialog {
|
||||||
|
private static final String ESC_ACTION_KEY = "ESC_ACTION";
|
||||||
|
|
||||||
private final java.util.List<EditorHolder> editors;
|
private final java.util.List<EditorHolder> editors;
|
||||||
private final JPanel panel;
|
private final JPanel panel;
|
||||||
@ -95,6 +97,13 @@ public class AttributeDialog extends JDialog {
|
|||||||
getContentPane().add(buttonPanel, BorderLayout.SOUTH);
|
getContentPane().add(buttonPanel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
getRootPane().setDefaultButton(okButton);
|
getRootPane().setDefaultButton(okButton);
|
||||||
|
getRootPane().getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), ESC_ACTION_KEY);
|
||||||
|
getRootPane().getActionMap().put(ESC_ACTION_KEY, new AbstractAction() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user