1654 public void show(boolean b) { 1655 if (b) { 1656 show(); 1657 } else { 1658 hide(); 1659 } 1660 } 1661 1662 boolean containsFocus() { 1663 return isFocusOwner(); 1664 } 1665 1666 void clearMostRecentFocusOwnerOnHide() { 1667 KeyboardFocusManager.clearMostRecentFocusOwner(this); 1668 } 1669 1670 void clearCurrentFocusCycleRootOnHide() { 1671 /* do nothing */ 1672 } 1673 1674 /** 1675 * @deprecated As of JDK version 1.1, 1676 * replaced by <code>setVisible(boolean)</code>. 1677 */ 1678 @Deprecated 1679 public void hide() { 1680 isPacked = false; 1681 1682 if (visible) { 1683 clearCurrentFocusCycleRootOnHide(); 1684 clearMostRecentFocusOwnerOnHide(); 1685 synchronized (getTreeLock()) { 1686 visible = false; 1687 mixOnHiding(isLightweight()); 1688 if (containsFocus() && KeyboardFocusManager.isAutoFocusTransferEnabled()) { 1689 transferFocus(true); 1690 } 1691 ComponentPeer peer = this.peer; 1692 if (peer != null) { 1693 peer.setVisible(false); 6957 * <p> 6958 * This method is called by the toolkit internally and should 6959 * not be called directly by programs. Code overriding 6960 * this method should call <code>super.removeNotify</code> as 6961 * the first line of the overriding method. 6962 * 6963 * @see #isDisplayable 6964 * @see #addNotify 6965 * @since JDK1.0 6966 */ 6967 public void removeNotify() { 6968 KeyboardFocusManager.clearMostRecentFocusOwner(this); 6969 if (KeyboardFocusManager.getCurrentKeyboardFocusManager(). 6970 getPermanentFocusOwner() == this) 6971 { 6972 KeyboardFocusManager.getCurrentKeyboardFocusManager(). 6973 setGlobalPermanentFocusOwner(null); 6974 } 6975 6976 synchronized (getTreeLock()) { 6977 if (isFocusOwner() && KeyboardFocusManager.isAutoFocusTransferEnabledFor(this)) { 6978 transferFocus(true); 6979 } 6980 6981 if (getContainer() != null && isAddNotifyComplete) { 6982 getContainer().decreaseComponentCount(this); 6983 } 6984 6985 int npopups = (popups != null? popups.size() : 0); 6986 for (int i = 0 ; i < npopups ; i++) { 6987 PopupMenu popup = popups.elementAt(i); 6988 popup.removeNotify(); 6989 } 6990 // If there is any input context for this component, notify 6991 // that this component is being removed. (This has to be done 6992 // before hiding peer.) 6993 if ((eventMask & AWTEvent.INPUT_METHODS_ENABLED_MASK) != 0) { 6994 InputContext inputContext = getInputContext(); 6995 if (inputContext != null) { 6996 inputContext.removeNotify(this); | 1654 public void show(boolean b) { 1655 if (b) { 1656 show(); 1657 } else { 1658 hide(); 1659 } 1660 } 1661 1662 boolean containsFocus() { 1663 return isFocusOwner(); 1664 } 1665 1666 void clearMostRecentFocusOwnerOnHide() { 1667 KeyboardFocusManager.clearMostRecentFocusOwner(this); 1668 } 1669 1670 void clearCurrentFocusCycleRootOnHide() { 1671 /* do nothing */ 1672 } 1673 1674 /* 1675 * Delete references from LightweithDispatcher of a heavyweight parent 1676 */ 1677 void clearLightweightDispatcherOnRemove(Component removedComponent) { 1678 if (parent != null) { 1679 parent.clearLightweightDispatcherOnRemove(removedComponent); 1680 } 1681 } 1682 1683 /** 1684 * @deprecated As of JDK version 1.1, 1685 * replaced by <code>setVisible(boolean)</code>. 1686 */ 1687 @Deprecated 1688 public void hide() { 1689 isPacked = false; 1690 1691 if (visible) { 1692 clearCurrentFocusCycleRootOnHide(); 1693 clearMostRecentFocusOwnerOnHide(); 1694 synchronized (getTreeLock()) { 1695 visible = false; 1696 mixOnHiding(isLightweight()); 1697 if (containsFocus() && KeyboardFocusManager.isAutoFocusTransferEnabled()) { 1698 transferFocus(true); 1699 } 1700 ComponentPeer peer = this.peer; 1701 if (peer != null) { 1702 peer.setVisible(false); 6966 * <p> 6967 * This method is called by the toolkit internally and should 6968 * not be called directly by programs. Code overriding 6969 * this method should call <code>super.removeNotify</code> as 6970 * the first line of the overriding method. 6971 * 6972 * @see #isDisplayable 6973 * @see #addNotify 6974 * @since JDK1.0 6975 */ 6976 public void removeNotify() { 6977 KeyboardFocusManager.clearMostRecentFocusOwner(this); 6978 if (KeyboardFocusManager.getCurrentKeyboardFocusManager(). 6979 getPermanentFocusOwner() == this) 6980 { 6981 KeyboardFocusManager.getCurrentKeyboardFocusManager(). 6982 setGlobalPermanentFocusOwner(null); 6983 } 6984 6985 synchronized (getTreeLock()) { 6986 clearLightweightDispatcherOnRemove(this); 6987 6988 if (isFocusOwner() && KeyboardFocusManager.isAutoFocusTransferEnabledFor(this)) { 6989 transferFocus(true); 6990 } 6991 6992 if (getContainer() != null && isAddNotifyComplete) { 6993 getContainer().decreaseComponentCount(this); 6994 } 6995 6996 int npopups = (popups != null? popups.size() : 0); 6997 for (int i = 0 ; i < npopups ; i++) { 6998 PopupMenu popup = popups.elementAt(i); 6999 popup.removeNotify(); 7000 } 7001 // If there is any input context for this component, notify 7002 // that this component is being removed. (This has to be done 7003 // before hiding peer.) 7004 if ((eventMask & AWTEvent.INPUT_METHODS_ENABLED_MASK) != 0) { 7005 InputContext inputContext = getInputContext(); 7006 if (inputContext != null) { 7007 inputContext.removeNotify(this); |