List of usage examples for java.awt.event WindowEvent getID
public int getID()
From source file:Main.java
protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_DEACTIVATED) { System.out.println(WindowEvent.WINDOW_DEACTIVATED); dispose();/* w w w . j a v a 2s. c o m*/ System.exit(0); } super.processWindowEvent(e); // Pass on the event }
From source file:Main.java
protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_FIRST) { System.out.println(WindowEvent.WINDOW_FIRST); dispose();/* w w w .java 2 s. c o m*/ System.exit(0); } super.processWindowEvent(e); // Pass on the event }
From source file:EventTestPane.java
/** Display Window events. Note the special handling of WINDOW_CLOSING */ public void processWindowEvent(WindowEvent e) { switch (e.getID()) { case WindowEvent.WINDOW_OPENED: showLine("WINDOW_OPENED"); break;/* w ww . j a v a 2 s .c om*/ case WindowEvent.WINDOW_CLOSED: showLine("WINDOW_CLOSED"); break; case WindowEvent.WINDOW_CLOSING: showLine("WINDOW_CLOSING"); break; case WindowEvent.WINDOW_ICONIFIED: showLine("WINDOW_ICONIFIED"); break; case WindowEvent.WINDOW_DEICONIFIED: showLine("WINDOW_DEICONIFIED"); break; case WindowEvent.WINDOW_ACTIVATED: showLine("WINDOW_ACTIVATED"); break; case WindowEvent.WINDOW_DEACTIVATED: showLine("WINDOW_DEACTIVATED"); break; } // If the user requested a window close, quit the program. // But first display a message, force it to be visible, and make // sure the user has time to read it. if (e.getID() == WindowEvent.WINDOW_CLOSING) { showLine("WINDOW_CLOSING event received."); showLine("Application will exit in 5 seconds"); // Force the updates to appear now. update(this.getGraphics()); // Wait five seconds try { Thread.sleep(5000); } catch (InterruptedException ie) { ; } // Exit now System.exit(0); } }
From source file:be.ac.ua.comp.scarletnebula.gui.windows.LinkUnlinkWindow.java
@Override protected void processWindowEvent(final WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { actuallyLinkUnlink();// www .j a v a 2s. co m LinkUnlinkWindow.this.dispose(); } }
From source file:at.ac.tuwien.ibk.biqini.pep.gui.PEPGUI.java
protected void processWindowEvent(WindowEvent e) { // while closing this window avoid the termination of the complete program if (e.getID() == WindowEvent.WINDOW_CLOSING) { this.dispose(); } else//from w w w. j av a2 s .co m super.processWindowEvent(e); }
From source file:com.qawaa.gui.EventWebScanGUI.java
@Override protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_CLOSING) { this.windowsClosed(); }//from w ww . j a v a 2 s . c o m //super.processWindowEvent(e); }
From source file:com.babynamesUI.java
protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_CLOSING) { //System.exit(0); //remove on release int exit = JOptionPane.showConfirmDialog(this, "Are you sure?", "Confirm Exit?", JOptionPane.YES_NO_OPTION); if (exit == JOptionPane.YES_OPTION) { System.exit(0);//from w w w .j a va2s . c o m } } else { super.processWindowEvent(e); } }
From source file:uk.co.moonsit.sockets.GraphClient.java
@Override protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { logger.info("Closing"); running = false;// w w w .j av a2s . c om try { Thread.sleep(1000); client.close(); } catch (IOException | InterruptedException ex) { Logger.getLogger(GraphClient.class.getName()).log(Level.SEVERE, null, ex); } if (record) { try { if (config != null && data.size() > 0) { saveData(); } } catch (IOException ex) { Logger.getLogger(GraphClient.class.getName()).log(Level.SEVERE, null, ex); } } System.exit(0); } }
From source file:org.ash.gui.MainFrame.java
@Override protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { menuFileExit_actionPerformed(null); }/*from w w w . j a v a 2 s. co m*/ }
From source file:ee.ioc.cs.vsle.editor.Editor.java
/** * Overridden so we can exit when window is closed * //from ww w .java 2s .c om * @param e - Window Event. */ @Override protected void processWindowEvent(WindowEvent e) { // super.processWindowEvent(e); // automatic closing disabled, // confirmation asked instead. if (e.getID() == WindowEvent.WINDOW_CLOSING) { exitApplication(); } else { super.processWindowEvent(e); } }