I know I need to creat class that will implement WindowListener. But what even should I catch ?? And also... I need to restrict this function... so my window can't be maximised... how do i do this ? Any hints ??? Please help.
if your class implements WindowListener, you'll have to implement these methods:
public void windowClosing(WindowEvent e)
public void windowClosed(WindowEvent e)
public void windowOpening(WindowEvent e)
public void windowOpened(WindowEvent e)
public void windowActivated(WindowEvent e)
public void windowDeactivated(WindowEvent e)
public void windowIconified(WindowEvent e)
public void windowDeiconified(WindowEvent e)
I usually implement all the methods in blank except the windowClosing. I usually use System.exit(0) or this.dispose() if its a multiframe app.
When I don't want the window to be maximized I use setResizable(false).
I don't know if that's what you were asking for but I hope it helps.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.