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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>The</strong> new @Action annotation// define sayHello Action – pops up message Dialog@Action public void sayHello() {String s = textField.getText();JOptionPane.showMessageDialog(s);}// use sayHello – set the action propertyAction sayHello = getAction("sayHello");textField.setAction(sayHello);button.setAction(sayHello);●●●ActionEvent argument is optionalUsed to define a “sayHello” ActionMap entryEncapsulation of default GUI + behavior2007 <strong>Java</strong>One SM Conference | Session TS-3942 | 38

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

Saved successfully!

Ooh no, something went wrong!