Example usage for javax.swing JFrame removeWindowListener

List of usage examples for javax.swing JFrame removeWindowListener

Introduction

In this page you can find the example usage for javax.swing JFrame removeWindowListener.

Prototype

public synchronized void removeWindowListener(WindowListener l) 

Source Link

Document

Removes the specified window listener so that it no longer receives window events from this window.

Usage

From source file:edu.ku.brc.specify.tasks.subpane.wb.WorkbenchPaneSS.java

@Override
public void shutdown() {
    //Check to see if background tasks accessing the Workbench are active.
    if (shutdownLock.get() > 0) {
        return;/* w  w w. ja  v a 2 s.co m*/
    }

    if (spreadSheet == null) {
        return;
    }

    //--------------------------------------------------------------------------------
    // I really don't know how much of all this is necessary
    // but using the JProfiler it seems things got better when I did certain things.
    //--------------------------------------------------------------------------------

    UIRegistry.getLaunchFindReplaceAction().setSearchReplacePanel(null);
    UIRegistry.enableFind(null, false);

    JFrame topFrame = (JFrame) UIRegistry.getTopWindow();

    if (minMaxWindowListener != null) {
        topFrame.removeWindowListener(minMaxWindowListener);
        minMaxWindowListener = null;
    }

    shutdownValidators();

    removeAll();
    if (mainPanel != null) {
        mainPanel.removeAll();
    }
    if (controllerPane != null) {
        controllerPane.removeAll();
    }

    if (spreadSheet != null) {
        spreadSheet.setVisible(false);
        spreadSheet.getSelectionModel().removeListSelectionListener(workbenchRowChangeListener);
        spreadSheet.cleanUp();
        workbenchRowChangeListener = null;

        for (int i = 0; i < spreadSheet.getColumnCount(); i++) {
            TableColumn column = spreadSheet.getColumnModel().getColumn(i);
            TableCellEditor editor = column.getCellEditor();
            if (editor instanceof GridCellEditor) {
                ((GridCellEditor) editor).cleanUp();
            }
        }
        TableCellEditor editor = spreadSheet.getCellEditor();
        if (editor instanceof GridCellEditor) {
            ((GridCellEditor) editor).cleanUp();
        }
    }

    if (imageFrame != null) {
        imageFrame.cleanUp();
        imageFrame.dispose();
    }

    if (mapFrame != null) {
        mapFrame.dispose();
    }

    if (model != null) {
        model.cleanUp();
    }

    if (headers != null) {
        headers.clear();
    }

    if (resultsetController != null) {
        resultsetController.removeListener(formPane);
        resultsetController = null;
    }

    if (formPane != null) {
        formPane.cleanup();
    }

    formPane = null;
    findPanel = null;
    spreadSheet = null;
    workbench = null;
    model = null;
    imageColExt = null;
    columns = null;
    imageFrame = null;
    headers = null;
    recordSet = null;
    mainPanel = null;
    controllerPane = null;
    currentPanelType = null;
    cardLayout = null;
    cpCardLayout = null;
    uploadToolPanel = null;
    workBenchPlugins = null;

    super.shutdown();
}