
Java
A good example is the MouseListener interface. Let's say you want to detect when a user clicks on your Component. You only need to implement the mouseClicked method to get that part working. This will leave you with...
public void mousePressed(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {
}
public void mouseEntered(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
...at the end of your implementation. Ugly. So Java gives us the MouseAdapter class (which gives us the same empty implementations as above). We can use this in place of a MouseListener to try to keep our code cleaner.
Copyright © 2026 eLLeNow.com All Rights Reserved.