final JFrame frame = new JFrame();
ActionListener actionListener =new ActionListener(){
public void actionPerformed(ActionEvent e) {
frame.dispose();
}
};
frame.getRootPane().registerKeyboardAction(actionListener, "command",
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
JComponent.WHEN_IN_FOCUSED_WINDOW);
// TestGroupHeaderExample example = new TestGroupHeaderExample();
// JPanel panel = example.getPanel();
// frame.add(panel);
frame.pack();
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);