12.07.2015 Views

Swing Widgets

Swing Widgets

Swing Widgets

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

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

Using inner classes as listeners Another way: one inner class for each listener Each widget uses its own listener object Each listener is an instance of its own class● public MyWin extends JFrame { public MyWin() { }● JButton q = new JButton(“Quit”);● q.addActionListener( new QListener() ); private class QListener implementsActionListener {● public voidactionPerformed( ActionEvent e );CMPT166: widgets 10 Feb 20105

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

Saved successfully!

Ooh no, something went wrong!