Java Code Examples for javax.swing.JFrame.removeWindowListener()

The following are Jave code examples for showing how to use removeWindowListener() of the javax.swing.JFrame class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: call-IDE   File: ConsoleCore.java   Source Code and License Vote up 6 votes
/**
 * Description: dispatches the console from its current place properly.
 */
public static void  dispatch(JScrollPane scrollPane, JTextPane cons,
                             JTabbedPane outputTabs, Component tabComp, JFrame frame,
                             Boolean consoleOut, Attachable mainFrame) {
    frame.setSize(600, 400);
    frame.setLocationRelativeTo( (Component) mainFrame);
    frame.setLayout(new BorderLayout());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    
    scrollPane.setViewportView(cons);
    frame.add(scrollPane);
    
    if (frame.getWindowListeners().length > 0)
        frame.removeWindowListener(frame.getWindowListeners()[0]);
    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            mainFrame.attachConsole();
        }
    });
    frame.setVisible(true);
}
 
Example 2
Project: Logisim   File: WindowMenuItemManager.java   Source Code and License Vote up 5 votes
public void frameClosed(JFrame frame) {
	if (!persistent) {
		if (listenerAdded) {
			frame.removeWindowListener(myListener);
			listenerAdded = false;
		}
		removeFromManager();
	}
}