Files
BUT2/DEV/DEV3.1/TP03/Exercise1/GridWindowClosedEvent.java
2025-10-02 10:48:05 +02:00

20 lines
597 B
Java

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JOptionPane;
public class GridWindowClosedEvent extends WindowAdapter {
private GridWindow window;
public GridWindowClosedEvent(GridWindow window) {
this.window = window;
}
@Override
public void windowClosing(WindowEvent event) {
int result = JOptionPane.showConfirmDialog(this.window, "Are you sure you want to close this window?", "Close current window", JOptionPane.YES_NO_OPTION);
if(result == JOptionPane.YES_OPTION) this.window.dispose();
}
}