!747 !actionListener { !x619 // CenteredLine m { static S snippetID = "#1000833"; // take me as an example static JFrame frame; p { JButton btnOK = new JButton("OK"); btnOK.addActionListener(actionListener { ok(); }); JButton btnCancel = new JButton("Cancel"); btnCancel.addActionListener(actionListener { cancel(); }); JPanel panel = topToBottomPanel(); panel.add(new JLabel("Run " + snippetID + "?", SwingConstants.CENTER)); panel.add(new CenteredLine(btnOK, btnCancel)); frame = new JFrame("Run " + snippetID); frame.add(panel); frame.setBounds(200, 300, 400, 250); frame.setVisible(true); exitOnFrameClose(frame); } static void ok() { frame.dispose(); } static void cancel() { frame.dispose(); } }