src/java.desktop/share/classes/java/awt/MenuComponent.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 55,65 **** if (!GraphicsEnvironment.isHeadless()) { initIDs(); } } ! transient MenuComponentPeer peer; transient MenuContainer parent; /** * The <code>AppContext</code> of the <code>MenuComponent</code>. * This is set in the constructor and never changes. --- 55,65 ---- if (!GraphicsEnvironment.isHeadless()) { initIDs(); } } ! transient volatile MenuComponentPeer peer; transient MenuContainer parent; /** * The <code>AppContext</code> of the <code>MenuComponent</code>. * This is set in the constructor and never changes.
*** 140,149 **** --- 140,154 ---- public void setAppContext(MenuComponent menuComp, AppContext appContext) { menuComp.appContext = appContext; } @Override + @SuppressWarnings("unchecked") + public <T extends MenuComponentPeer> T getPeer(MenuComponent menuComp) { + return (T) menuComp.peer; + } + @Override public MenuContainer getParent(MenuComponent menuComp) { return menuComp.parent; } @Override public void setParent(MenuComponent menuComp, MenuContainer menuContainer) {
*** 224,243 **** final MenuContainer getParent_NoClientCode() { return parent; } /** - * @deprecated As of JDK version 1.1, - * programs should not directly manipulate peers. - * @return the peer for this component - */ - @Deprecated - public MenuComponentPeer getPeer() { - return peer; - } - - /** * Gets the font used for this menu component. * @return the font used in this menu component, if there is one; * <code>null</code> otherwise * @see java.awt.MenuComponent#setFont */ --- 229,238 ----