Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect JFrame window minimize and maximize events?

Is there a way to an event listener to a JFrame object to detect when the user clicks the window maximize or minimize buttons?

Am using the JFrame object as follows:

JFrame frame = new JFrame("Frame");

like image 953
Markel Mairs Avatar asked Jun 22 '12 01:06

Markel Mairs


2 Answers

You can use WindowStateListener. How to Write Window Listeners tutorial demonstrates how to create window-related event handlers.

like image 179
tenorsax Avatar answered Nov 09 '22 15:11

tenorsax


Yes, you can do this by implementing WindowListener methods namely windowIconified(WindowEvent e) by windowDeiconified(WindowEvent e).

For more details, visit this

like image 24
agarwav Avatar answered Nov 09 '22 16:11

agarwav