Java Code Examples for java.awt.event.WindowEvent#getID()
The following examples show how to use
java.awt.event.WindowEvent#getID() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JFrame.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Processes window events occurring on this component. * Hides the window or disposes of it, as specified by the setting * of the <code>defaultCloseOperation</code> property. * * @param e the window event * @see #setDefaultCloseOperation * @see java.awt.Window#processWindowEvent */ protected void processWindowEvent(final WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { switch (defaultCloseOperation) { case HIDE_ON_CLOSE: setVisible(false); break; case DISPOSE_ON_CLOSE: dispose(); break; case EXIT_ON_CLOSE: // This needs to match the checkExit call in // setDefaultCloseOperation System.exit(0); break; case DO_NOTHING_ON_CLOSE: default: } } }
Example 2
Source File: JFrame.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Processes window events occurring on this component. * Hides the window or disposes of it, as specified by the setting * of the <code>defaultCloseOperation</code> property. * * @param e the window event * @see #setDefaultCloseOperation * @see java.awt.Window#processWindowEvent */ protected void processWindowEvent(final WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { switch (defaultCloseOperation) { case HIDE_ON_CLOSE: setVisible(false); break; case DISPOSE_ON_CLOSE: dispose(); break; case EXIT_ON_CLOSE: // This needs to match the checkExit call in // setDefaultCloseOperation System.exit(0); break; case DO_NOTHING_ON_CLOSE: default: } } }
Example 3
Source File: JFrame.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Processes window events occurring on this component. * Hides the window or disposes of it, as specified by the setting * of the <code>defaultCloseOperation</code> property. * * @param e the window event * @see #setDefaultCloseOperation * @see java.awt.Window#processWindowEvent */ protected void processWindowEvent(final WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { switch (defaultCloseOperation) { case HIDE_ON_CLOSE: setVisible(false); break; case DISPOSE_ON_CLOSE: dispose(); break; case EXIT_ON_CLOSE: // This needs to match the checkExit call in // setDefaultCloseOperation System.exit(0); break; case DO_NOTHING_ON_CLOSE: default: } } }
Example 4
Source File: JFrame.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * Processes window events occurring on this component. * Hides the window or disposes of it, as specified by the setting * of the <code>defaultCloseOperation</code> property. * * @param e the window event * @see #setDefaultCloseOperation * @see java.awt.Window#processWindowEvent */ protected void processWindowEvent(final WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { switch (defaultCloseOperation) { case HIDE_ON_CLOSE: setVisible(false); break; case DISPOSE_ON_CLOSE: dispose(); break; case EXIT_ON_CLOSE: // This needs to match the checkExit call in // setDefaultCloseOperation System.exit(0); break; case DO_NOTHING_ON_CLOSE: default: } } }
Example 5
Source File: DefaultWindowController.java From lnk2pwn with MIT License | 6 votes |
@Override public void eventDispatched(AWTEvent event) { if (event instanceof WindowEvent) { WindowEvent windowEvent = (WindowEvent) event; switch(windowEvent.getID()) { case WindowEvent.WINDOW_ACTIVATED: window = windowEvent.getWindow(); break; case WindowEvent.WINDOW_DEACTIVATED: window = null; break; default: break; } } }
Example 6
Source File: JFrame.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Processes window events occurring on this component. * Hides the window or disposes of it, as specified by the setting * of the <code>defaultCloseOperation</code> property. * * @param e the window event * @see #setDefaultCloseOperation * @see java.awt.Window#processWindowEvent */ protected void processWindowEvent(final WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { switch (defaultCloseOperation) { case HIDE_ON_CLOSE: setVisible(false); break; case DISPOSE_ON_CLOSE: dispose(); break; case EXIT_ON_CLOSE: // This needs to match the checkExit call in // setDefaultCloseOperation System.exit(0); break; case DO_NOTHING_ON_CLOSE: default: } } }
Example 7
Source File: JFrame.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Processes window events occurring on this component. * Hides the window or disposes of it, as specified by the setting * of the <code>defaultCloseOperation</code> property. * * @param e the window event * @see #setDefaultCloseOperation * @see java.awt.Window#processWindowEvent */ protected void processWindowEvent(final WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { switch (defaultCloseOperation) { case HIDE_ON_CLOSE: setVisible(false); break; case DISPOSE_ON_CLOSE: dispose(); break; case EXIT_ON_CLOSE: // This needs to match the checkExit call in // setDefaultCloseOperation System.exit(0); break; case DO_NOTHING_ON_CLOSE: default: } } }
Example 8
Source File: JFrame.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Processes window events occurring on this component. * Hides the window or disposes of it, as specified by the setting * of the <code>defaultCloseOperation</code> property. * * @param e the window event * @see #setDefaultCloseOperation * @see java.awt.Window#processWindowEvent */ protected void processWindowEvent(final WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { switch (defaultCloseOperation) { case HIDE_ON_CLOSE: setVisible(false); break; case DISPOSE_ON_CLOSE: dispose(); break; case EXIT_ON_CLOSE: // This needs to match the checkExit call in // setDefaultCloseOperation System.exit(0); break; case DO_NOTHING_ON_CLOSE: default: } } }
Example 9
Source File: JFrame.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Processes window events occurring on this component. * Hides the window or disposes of it, as specified by the setting * of the <code>defaultCloseOperation</code> property. * * @param e the window event * @see #setDefaultCloseOperation * @see java.awt.Window#processWindowEvent */ protected void processWindowEvent(final WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { switch (defaultCloseOperation) { case HIDE_ON_CLOSE: setVisible(false); break; case DISPOSE_ON_CLOSE: dispose(); break; case EXIT_ON_CLOSE: // This needs to match the checkExit call in // setDefaultCloseOperation System.exit(0); break; case DO_NOTHING_ON_CLOSE: default: } } }
Example 10
Source File: JFrame.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Processes window events occurring on this component. * Hides the window or disposes of it, as specified by the setting * of the <code>defaultCloseOperation</code> property. * * @param e the window event * @see #setDefaultCloseOperation * @see java.awt.Window#processWindowEvent */ protected void processWindowEvent(final WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { switch (defaultCloseOperation) { case HIDE_ON_CLOSE: setVisible(false); break; case DISPOSE_ON_CLOSE: dispose(); break; case EXIT_ON_CLOSE: // This needs to match the checkExit call in // setDefaultCloseOperation System.exit(0); break; case DO_NOTHING_ON_CLOSE: default: } } }
Example 11
Source File: JFrame.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Processes window events occurring on this component. * Hides the window or disposes of it, as specified by the setting * of the <code>defaultCloseOperation</code> property. * * @param e the window event * @see #setDefaultCloseOperation * @see java.awt.Window#processWindowEvent */ protected void processWindowEvent(final WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { switch (defaultCloseOperation) { case HIDE_ON_CLOSE: setVisible(false); break; case DISPOSE_ON_CLOSE: dispose(); break; case EXIT_ON_CLOSE: // This needs to match the checkExit call in // setDefaultCloseOperation System.exit(0); break; case DO_NOTHING_ON_CLOSE: default: } } }
Example 12
Source File: JFrame.java From Java8CN with Apache License 2.0 | 6 votes |
/** * Processes window events occurring on this component. * Hides the window or disposes of it, as specified by the setting * of the <code>defaultCloseOperation</code> property. * * @param e the window event * @see #setDefaultCloseOperation * @see java.awt.Window#processWindowEvent */ protected void processWindowEvent(final WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { switch (defaultCloseOperation) { case HIDE_ON_CLOSE: setVisible(false); break; case DISPOSE_ON_CLOSE: dispose(); break; case EXIT_ON_CLOSE: // This needs to match the checkExit call in // setDefaultCloseOperation System.exit(0); break; case DO_NOTHING_ON_CLOSE: default: } } }
Example 13
Source File: JTSTestBuilderFrame.java From jts with GNU Lesser General Public License v2.1 | 5 votes |
/** * Overridden so we can exit when window is closed */ protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { jMenuFileExit_actionPerformed(null); } }
Example 14
Source File: UnitSelectorDialog.java From megamek with GNU General Public License v2.0 | 5 votes |
@Override protected void processWindowEvent(WindowEvent e){ super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_DEACTIVATED){ GUIPreferences guip = GUIPreferences.getInstance(); guip.setMechSelectorUnitType(comboUnitType.getSelectedIndex()); guip.setMechSelectorWeightClass(comboWeight.getSelectedIndex()); guip.setMechSelectorRulesLevels(Arrays.toString(lstTechLevel.getSelectedIndices())); guip.setMechSelectorSizeHeight(getSize().height); guip.setMechSelectorSizeWidth(getSize().width); } }
Example 15
Source File: SpoolExportWizard.java From tn5250j with GNU General Public License v2.0 | 5 votes |
/** * Overridden so we can exit when window is closed */ protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { this.setVisible(false); this.dispose(); } }
Example 16
Source File: Window.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Processes window events occurring on this window by * dispatching them to any registered WindowListener objects. * NOTE: This method will not be called unless window events * are enabled for this component; this happens when one of the * following occurs: * <ul> * <li>A WindowListener object is registered via * {@code addWindowListener} * <li>Window events are enabled via {@code enableEvents} * </ul> * <p>Note that if the event parameter is {@code null} * the behavior is unspecified and may result in an * exception. * * @param e the window event * @see Component#enableEvents */ protected void processWindowEvent(WindowEvent e) { WindowListener listener = windowListener; if (listener != null) { switch(e.getID()) { case WindowEvent.WINDOW_OPENED: listener.windowOpened(e); break; case WindowEvent.WINDOW_CLOSING: listener.windowClosing(e); break; case WindowEvent.WINDOW_CLOSED: listener.windowClosed(e); break; case WindowEvent.WINDOW_ICONIFIED: listener.windowIconified(e); break; case WindowEvent.WINDOW_DEICONIFIED: listener.windowDeiconified(e); break; case WindowEvent.WINDOW_ACTIVATED: listener.windowActivated(e); break; case WindowEvent.WINDOW_DEACTIVATED: listener.windowDeactivated(e); break; default: break; } } }
Example 17
Source File: VerifierAppFrame.java From commons-bcel with Apache License 2.0 | 5 votes |
/** Overridden to stop the application on a closing window. */ @Override protected void processWindowEvent( final WindowEvent e ) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { System.exit(0); } }
Example 18
Source File: CreatingWindow.java From egdownloader with GNU General Public License v2.0 | 5 votes |
@Override protected void processWindowEvent(WindowEvent e) { //关闭事件 if(e.getID() == WindowEvent.WINDOW_CLOSING){ //do nothing }else{ super.processWindowEvent(e); } }
Example 19
Source File: Window.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * Processes window focus event occurring on this window by * dispatching them to any registered WindowFocusListener objects. * NOTE: this method will not be called unless window focus events * are enabled for this window. This happens when one of the * following occurs: * <ul> * <li>a WindowFocusListener is registered via * {@code addWindowFocusListener} * <li>Window focus events are enabled via {@code enableEvents} * </ul> * <p>Note that if the event parameter is {@code null} * the behavior is unspecified and may result in an * exception. * * @param e the window focus event * @see Component#enableEvents * @since 1.4 */ protected void processWindowFocusEvent(WindowEvent e) { WindowFocusListener listener = windowFocusListener; if (listener != null) { switch (e.getID()) { case WindowEvent.WINDOW_GAINED_FOCUS: listener.windowGainedFocus(e); break; case WindowEvent.WINDOW_LOST_FOCUS: listener.windowLostFocus(e); break; default: break; } } }
Example 20
Source File: Window.java From Bytecoder with Apache License 2.0 | 3 votes |
/** * Processes window state event occurring on this window by * dispatching them to any registered {@code WindowStateListener} * objects. * NOTE: this method will not be called unless window state events * are enabled for this window. This happens when one of the * following occurs: * <ul> * <li>a {@code WindowStateListener} is registered via * {@code addWindowStateListener} * <li>window state events are enabled via {@code enableEvents} * </ul> * <p>Note that if the event parameter is {@code null} * the behavior is unspecified and may result in an * exception. * * @param e the window state event * @see java.awt.Component#enableEvents * @since 1.4 */ protected void processWindowStateEvent(WindowEvent e) { WindowStateListener listener = windowStateListener; if (listener != null) { switch (e.getID()) { case WindowEvent.WINDOW_STATE_CHANGED: listener.windowStateChanged(e); break; default: break; } } }