List of usage examples for java.awt.event WindowEvent WINDOW_OPENED
int WINDOW_OPENED
To view the source code for java.awt.event WindowEvent WINDOW_OPENED.
Click Source Link
From source file:Main.java
protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_OPENED) { System.out.println(WindowEvent.WINDOW_OPENED); dispose();/*from w ww .ja va 2s .c o m*/ System.exit(0); } super.processWindowEvent(e); // Pass on the event }
From source file:Main.java
public void eventDispatched(AWTEvent evt) { if (evt.getID() == WindowEvent.WINDOW_OPENED) { ComponentEvent cev = (ComponentEvent) evt; if (cev.getComponent() instanceof JFrame) { System.out.println("event: " + evt); JFrame frame = (JFrame) cev.getComponent(); loadSettings(frame);/*from w w w. j av a 2 s . co m*/ } } }
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;/*from w w w .j av a 2s .co m*/ 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:org.eclipse.jubula.rc.swing.listener.ComponentHandler.java
/** * {@inheritDoc}//w w w . j a v a 2 s. c om */ public void eventDispatched(AWTEvent event) { final ClassLoader originalCL = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); try { if (log.isDebugEnabled()) { log.debug(event.paramString()); } final int id = event.getID(); ComponentEvent componentEvent; switch (id) { case WindowEvent.WINDOW_ACTIVATED: case WindowEvent.WINDOW_OPENED: // add recursivly all components to AUTHierarchy // and create names for unnamed components Window window = ((WindowEvent) event).getWindow(); autHierarchy.add(window); break; case ContainerEvent.COMPONENT_ADDED: checkContainerListener((ContainerEvent) event); break; case ComponentEvent.COMPONENT_HIDDEN: componentEvent = (ComponentEvent) event; if (!hasListener(componentEvent.getComponent(), ComponentListener.class)) { autHierarchy.componentHidden(componentEvent); } break; case ComponentEvent.COMPONENT_SHOWN: componentEvent = (ComponentEvent) event; if (!hasListener(componentEvent.getComponent(), ComponentListener.class)) { autHierarchy.componentShown(componentEvent); } break; default: // do nothing } if (AUTServer.getInstance().getMode() == ChangeAUTModeMessage.OBJECT_MAPPING) { AUTServer.getInstance().updateHighLighter(); } } catch (Throwable t) { log.error("exception during ComponentHandler", t); //$NON-NLS-1$ } finally { Thread.currentThread().setContextClassLoader(originalCL); } }
From source file:EventDispatchThreadHangMonitor.java
/** * Overrides EventQueue.dispatchEvent to call our pre and post hooks either * side of the system's event dispatch code. *///from w w w . ja va 2 s . c o m @Override protected void dispatchEvent(AWTEvent event) { try { preDispatchEvent(); super.dispatchEvent(event); } finally { postDispatchEvent(); if (!haveShownSomeComponent && event instanceof WindowEvent && event.getID() == WindowEvent.WINDOW_OPENED) { haveShownSomeComponent = true; } } }
From source file:com.moneydance.modules.features.mdvenmoimporter.VenmoImporterWindow.java
public final void processEvent(AWTEvent evt) { if (evt.getID() == WindowEvent.WINDOW_CLOSING) { extension.closeConsole();/*w ww .java 2 s . c o m*/ return; } if (evt.getID() == WindowEvent.WINDOW_OPENED) { } super.processEvent(evt); }