List of usage examples for java.awt KeyboardFocusManager clearGlobalFocusOwner
public void clearGlobalFocusOwner() throws SecurityException
From source file:org.kepler.gui.KeplerGraphFrame.java
/** * Override the dispose method to unattach any listeners that may keep this * model from getting garbage collected. Also remove KARManager's mapping of * this JFrame to KARfile if necessary./*from ww w . j av a 2s .co m*/ */ @Override public void dispose() { if (_topPack instanceof KeplerMenuHandler) { KeplerMenuHandler topPack = (KeplerMenuHandler) _topPack; MenuMapper mm = topPack.menuMapper; mm.clear(); /* * mm.printDebugInfo(); Map<String,Action> m = * mm.getPTIIMenuActionsMap(); m.clear(); KeplerMenuHandler kmh = * (KeplerMenuHandler) _topPack; kmh.clear(); _topPack = null; */ } JMenuBar keplerMenuBar = getJMenuBar(); /* int removed = */MemoryCleaner.removeActionListeners(keplerMenuBar); // System.out.println("KeplerGraphFrame menubar action listeners removed: " // + removed); CanvasDropTargetListener listener = CanvasDropTargetListener.getInstance(); if (listener != null && _dropTarget != null) { _dropTarget.deRegisterAdditionalListener(listener); } if (_horizontalScrollBarListener != null && _horizontalScrollBar != null) { _horizontalScrollBar.removeAdjustmentListener(_horizontalScrollBarListener); _horizontalScrollBarListener = null; } if (_verticalScrollBarListener != null && _verticalScrollBarListener != null) { _verticalScrollBar.removeAdjustmentListener(_verticalScrollBarListener); _verticalScrollBarListener = null; } // remove JFrame => KARFile mapping from KARManager KARManager karManager = KARManager.getInstance(); karManager.remove(this); TabManager tabManager = TabManager.getInstance(); tabManager.removeAllFrameTabs(this); // this isn't safe. see: // http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5095#c14 // it is safe now after changes in r26444. ObjectManager.getInstance().removeNamedObjs(this.getModel()); ViewManager.getInstance().removeOpenFrame(this); LibraryManager.getInstance().removeAllFrameTabs(this); // now call dispose on updaters in order synchronized (_updaterSet) { Iterator<KeplerGraphFrameUpdater> itr = _updaterSet.iterator(); while (itr.hasNext()) { KeplerGraphFrameUpdater updater = itr.next(); updater.dispose(this); } } ModelToFrameManager m2fm = ModelToFrameManager.getInstance(); m2fm.remove(this); // see if this was the last window if (m2fm.numberOfOpenFrames() == 0) { ShutdownNotifier.shutdown(); } KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); focusManager.clearGlobalFocusOwner(); focusManager.downFocusCycle(); super.dispose(); }