All pastes #24811 Raw Edit

Chmmr

public java v1 · immutable
#24811 ·published 2005-10-07 05:33 UTC
rendered paste body
public class Test extends JFrame{    private JPanel container;    private JTextArea textArea;    public Test() {        setLayout(new BorderLayout());        setUndecorated(true);        container = new JPanel();        textArea = new JTextArea("foo bar");        final String key = "exitAction";        final InputMap inputMap =                rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);        inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0), key);        rootPane.getActionMap().put(key, new AbstractAction() {            public void actionPerformed(ActionEvent e) {                System.exit(0);            }        });        container.add(textArea);        getContentPane().add(container, BorderLayout.CENTER);        setSize(400, 400);        setLocationRelativeTo(null);        setVisible(true);    }    public static void main(String[] a) {        EventQueue.invokeLater(new Runnable() {            public void run() {                new Test();            }        });    }}