some changes
This commit is contained in:
19
DEV/DEV3.1/TP03/Exercise1/GridWindowClosedEvent.java
Normal file
19
DEV/DEV3.1/TP03/Exercise1/GridWindowClosedEvent.java
Normal file
@@ -0,0 +1,19 @@
|
||||
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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user