Online Software Educational Training - IT Tutorials - Online Education Training for Computer Software


Home

JAVA APPLET

Adapter Classes

 Introduction to Adapter Classes

Java provides a special feature, called adapter class, that can simplify the creation of event handlers in certain situations. An adapter class provides an empty implementation of all methods in an event listener interface.  For example, the MouseMotionAdapter class has two methods, mouseDragged() and mouseMoved(). The signature of these empty methods are exactly as defined in the MouseMotionListener If you are interested in only mouse move events, then you can simply extend MouseMotionAdapter and implement mouseMoved().   

 Listener Interfaces Implemented by Adapter Classes

Adapter Classes

Listener Interface

ComponentAdapter ComponentListener
ContainerAdapter ContainerListener
FocusAdapter FocusListener
KeyAdapter KeyListener
MouseAdapter MouseListener
WindowAdapter WindowListener
MouseMotionAdapter MouseMotionListener

 


Previous

Next