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.

Actions: A (very) brief review●Encapsulation of an ActionListener and:●●some purely visual propertiesenabled and selected boolean properties// define sayHello Action – pops up message DialogAction sayHello = new AbstractAction("Hello") {public void actionPerformed(ActionEvent e) {String s = textField.getText();JOptionPane.showMessageDialog(s);}};// use sayHello – set the action propertytextField.setAction(sayHello);button.setAction(sayHello);2007 <strong>Java</strong>One SM Conference | Session TS-3942 | 34

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

Saved successfully!

Ooh no, something went wrong!