I have a program written in AWT, so I am using Frame (Not JFrame/Swing). I am using MenuItem objects to do some operations through ActionListeners.
However, on my last MenuItem, I want to use a WindowListener to close the frame (intending to close the frame without terminating the program altogether).
I am aware that the MenuItem documentation doesn't have a addWindowListener() method. But is there a way around that?
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
f.dispose();
}});
This is pretty much what I'm trying to do, but from a MenuItem.