All of the below applies for EclipseIde and IntellijIdea, although the key bindings vary somewhat
Eclipse has code completion for anonymous classes:
frame.addMouseListener(new M<caret is here>);typing CTRL+SPACE and selecting 'MouseAdapter' gives you
frame.addMouseListener(new MouseAdapter);then you type in '(){}' and add enter as you see fit to get something like:
frame.addMouseListener(new MouseAdapter() { <caret is here> } );typing CTRL+SPACE will show a list of methods you can override and selecting mouseClicked' gives you
frame.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { } } );as such, you can easily override other methods, now or later, as you like.
and IDEA:
frame.addMouseListener(new <caret is here>);typing CTRL+SHIFT+SPACE and selecting 'MouseAdapter' opens a list of overridable methods and gives the following code (depending on the selection of overridable methods):
frame.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } });(similar when MouseListener is selected instead of MouseAdapter). This works on any method that takes an interface reference as a parameter.