11.07.2015 Views

JSR-296: The Swing Application Framework - Java

JSR-296: The Swing Application Framework - Java

JSR-296: The Swing Application Framework - Java

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ExitListener Exampleclass MaybeExit implements <strong>Application</strong>.ExitListener {public boolean canExit(EventObject e) {JFrame f = getMainFrame();String s = "Really Exit?"; // *ResourceMapint o = JOptionPane.showConfirmDialog(f, s);return o == JOptionPane.YES_OPTION;}public void willExit(EventObject e) { }}<strong>Application</strong> app = <strong>Application</strong>.getInstance();app.addExitListener(new MaybeExit());2007 <strong>Java</strong>One SM Conference | Session TS-3942 | 22

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!