Added window closing event, code polish, added more comments
This commit is contained in:
parent
2364ee9c1a
commit
c7c400f206
@ -19,15 +19,24 @@ import java.awt.event.WindowAdapter;
|
|||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
|
|
||||||
class NotifyPopupWindowAdapter extends WindowAdapter {
|
class NotifyPopupWindowAdapter extends WindowAdapter {
|
||||||
|
public
|
||||||
|
void windowClosing(WindowEvent e) {
|
||||||
|
if (e.getNewState() != WindowEvent.WINDOW_CLOSED) {
|
||||||
|
NotifyPopup source = (NotifyPopup) e.getSource();
|
||||||
|
source.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public
|
public
|
||||||
void windowLostFocus(WindowEvent e) {
|
void windowLostFocus(WindowEvent e) {
|
||||||
if (e.getNewState() != WindowEvent.WINDOW_CLOSED) {
|
if (e.getNewState() != WindowEvent.WINDOW_CLOSED) {
|
||||||
NotifyPopup source = (NotifyPopup) e.getSource();
|
NotifyPopup source = (NotifyPopup) e.getSource();
|
||||||
|
// these don't work
|
||||||
//toFront();
|
//toFront();
|
||||||
//requestFocus();
|
//requestFocus();
|
||||||
|
//requestFocusInWindow();
|
||||||
source.setAlwaysOnTop(false);
|
source.setAlwaysOnTop(false);
|
||||||
source.setAlwaysOnTop(true);
|
source.setAlwaysOnTop(true);
|
||||||
//requestFocusInWindow();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user