Top "Windowlistener" questions

Java AWT and Swing listener interface for receiving window events.

Run function on JFrame close

void terminate() {} protected JFrame frame = new JFrame(); How can I get frame to run the terminate function when I press …

java swing jframe windowlistener
Basic Java Swing, how to exit and dispose of your application/JFrame

What is a good way to dispose of a JFrame with code like this? I want to handle the Window …

java swing windowlistener
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 …

java swing jframe awt windowlistener
Adding a new WindowListener to a JFrame

mainFrame.addWindowListener(new WindowListener() { @Override public void windowClosing(WindowEvent e) { if (JOptionPane.showConfirmDialog(mainFrame, "Are you sure you want to …

java swing jframe joptionpane windowlistener
How to override windowsClosing event in JFrame

i'm developing a JFrame which has a button to show another JFrame. On the second JFrame i want to override …

java swing jframe windowlistener
Java: Cancel Button does not close the window for JFrame

I want the window to close when I press on Cancel button, but it's not working. Code: public class FirstClass{ …

java swing listener actionlistener windowlistener
Terminate running threads on JFrame close

How do I invoke extra operations when the user closes a JFrame window? I have to stop existing threads. As …

java multithreading swing jframe windowlistener
How do I add functionality to the exit button without System.exit(0)?

I went through and had the program System.exit(0) whenever the user clicked the window's red exit button. Is there …

java swing windowlistener
Closing a java program properly when JDialog is the main window

I have a JDialog as the main window in my application (originally it was a JFrame but it showed in …

java swing windowlistener
JDialog with WindowListener - windowClosing not fired

I have a class that extends JDialog that have a window listener: class MyClass extends JDialog { public MyClass() { setDefaultCloseOperation( JDialog.…

java swing jdialog windowlistener