@@ -0,0 +1,469 @@
+import java.awt.event.*;%0A%0Apublic class WindowClosingAdapter extends WindowAdapter %7B%0A%09private boolean exitSystem;%0A%09%0A%09// Constructors%0A%09public WindowClosingAdapter(boolean exitSystem) %7B%0A%09%09this.exitSystem = exitSystem;%0A%09%7D%0A%09public WindowClosingAdapter() %7B%0A%09%09this(false);%0A%09%7D%0A%09%0A%09// Close window method%0A%09public void windowClosing(WindowEvent event) %7B%0A%09%09event.getWindow().setVisible(false);%0A%09%09event.getWindow().dispose();%0A%09%09if (exitSystem == true) %7B%0A%09%09%09System.exit(0);%0A%09%09%7D%0A%09%7D%0A%7D%0A

Create WindowClosingAdapter.java