Introduction to OOP | Chapter 22: The AWT and Swing : | next | previous | audio | real | text |
class MyWindow extends JFrame { public MyWindow () { ... addMouseListener (new MouseKeeper()); } ... private class MouseKeeper extends MouseAdapter { public void mousePressed (MouseEvent e) { ... } } }Inner classes are particularly usefor for this idiom.