I am trying to add a listener to a close operation JFrame:
addWindowListener(new WindowListener() {
@Override
public void windowClosing(WindowEvent e) {
setVisible(false);
}
});
The fact is that Eclipse keeps telling me that I have to “add unrealized methods”, which I believe is getting from WindowListener. However, I am confused, why do you need to implement all these other methods if you only need to override them? And if I add all these other methods, but don’t put any content in them, for example.
@Override
public void windowActivated(WindowEvent e) {}
will the default behavior for this method be lost? Or will it only get more complicated if I write something inside the method?
source
share