From c7c400f20679bafa46360fe8b569eb8aeb8522bc Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 4 Oct 2016 23:24:01 +0200 Subject: [PATCH] Added window closing event, code polish, added more comments --- src/dorkbox/notify/NotifyPopupWindowAdapter.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/dorkbox/notify/NotifyPopupWindowAdapter.java b/src/dorkbox/notify/NotifyPopupWindowAdapter.java index f56808f..1b94dc0 100644 --- a/src/dorkbox/notify/NotifyPopupWindowAdapter.java +++ b/src/dorkbox/notify/NotifyPopupWindowAdapter.java @@ -19,15 +19,24 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; class NotifyPopupWindowAdapter extends WindowAdapter { + public + void windowClosing(WindowEvent e) { + if (e.getNewState() != WindowEvent.WINDOW_CLOSED) { + NotifyPopup source = (NotifyPopup) e.getSource(); + source.close(); + } + } + public void windowLostFocus(WindowEvent e) { if (e.getNewState() != WindowEvent.WINDOW_CLOSED) { NotifyPopup source = (NotifyPopup) e.getSource(); + // these don't work //toFront(); //requestFocus(); + //requestFocusInWindow(); source.setAlwaysOnTop(false); source.setAlwaysOnTop(true); - //requestFocusInWindow(); } } }