Search in sources :

Example 16 with WindowListener

use of java.awt.event.WindowListener in project JMRI by JMRI.

the class ReporterIconTest method tearDown.

@Override
protected void tearDown() {
    // now close panel window
    if (panel != null) {
        java.awt.event.WindowListener[] listeners = panel.getTargetFrame().getWindowListeners();
        for (WindowListener listener : listeners) {
            panel.getTargetFrame().removeWindowListener(listener);
        }
        junit.extensions.jfcunit.TestHelper.disposeWindow(panel.getTargetFrame(), this);
    }
    apps.tests.Log4JFixture.tearDown();
}
Also used : WindowListener(java.awt.event.WindowListener)

Example 17 with WindowListener

use of java.awt.event.WindowListener in project ChatGameFontificator by GlitchCog.

the class ChatWindow method initChat.

/**
     * Sets the properties to get hooks into the properties' configuration models; Sets the ControlWindow to get hooks
     * back into the controls; Sets the loaded member Boolean to indicate it has everything it needs to begin rendering
     * the visualization
     * 
     * @param fProps
     * @param ctrlWindow
     * @throws IOException
     */
public void initChat(final FontificatorProperties fProps, final ControlWindow ctrlWindow) throws IOException {
    chatPanel = new ChatPanel();
    add(chatPanel);
    mouseListeners = new ChatMouseListeners(this, ctrlWindow);
    addMouseListener(mouseListeners);
    addMouseMotionListener(mouseListeners);
    addMouseWheelListener(chatPanel);
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    setSize(fProps.getChatConfig().getWidth(), fProps.getChatConfig().getHeight());
    setResizable(fProps.getChatConfig().isResizable());
    setAlwaysOnTop(fProps.getChatConfig().isAlwaysOnTop());
    chatPanel.setConfig(fProps);
    chatPanel.initExpirationTimer();
    addWindowListener(new WindowListener() {

        @Override
        public void windowOpened(WindowEvent e) {
        }

        @Override
        public void windowClosing(WindowEvent e) {
            callExit(e.getComponent());
        }

        @Override
        public void windowClosed(WindowEvent e) {
        }

        @Override
        public void windowIconified(WindowEvent e) {
        }

        @Override
        public void windowDeiconified(WindowEvent e) {
        }

        @Override
        public void windowActivated(WindowEvent e) {
        }

        @Override
        public void windowDeactivated(WindowEvent e) {
        }

        /**
             * Calls exit from the control window
             */
        private void callExit(Component caller) {
            ctrlWindow.attemptToExit(caller);
        }
    });
}
Also used : WindowListener(java.awt.event.WindowListener) WindowEvent(java.awt.event.WindowEvent) JComponent(javax.swing.JComponent) Component(java.awt.Component)

Example 18 with WindowListener

use of java.awt.event.WindowListener in project jgnash by ccavanaugh.

the class MainFrame method doPartialDispose.

/**
     * Dispose the UI without a complete program shutdown.
     */
void doPartialDispose() {
    PluginFactory.stopPlugins();
    for (final WindowListener listener : getWindowListeners()) {
        if (listener instanceof ShutdownAdapter) {
            removeWindowListener(listener);
        }
    }
    super.dispose();
}
Also used : WindowListener(java.awt.event.WindowListener)

Aggregations

WindowListener (java.awt.event.WindowListener)18 WindowEvent (java.awt.event.WindowEvent)7 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 JFrame (javax.swing.JFrame)2 BorderLayout (java.awt.BorderLayout)1 Component (java.awt.Component)1 Dialog (java.awt.Dialog)1 Frame (java.awt.Frame)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 Window (java.awt.Window)1 WindowAdapter (java.awt.event.WindowAdapter)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Preferences (java.util.prefs.Preferences)1 JComponent (javax.swing.JComponent)1 JFileChooser (javax.swing.JFileChooser)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1