1 /*
2 * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
203 /**
204 * Returns the parent container for this menu component.
205 * @return the menu component containing this menu component,
206 * or <code>null</code> if this menu component
207 * is the outermost component, the menu bar itself
208 */
209 public MenuContainer getParent() {
210 return getParent_NoClientCode();
211 }
212 // NOTE: This method may be called by privileged threads.
213 // This functionality is implemented in a package-private method
214 // to insure that it cannot be overridden by client subclasses.
215 // DO NOT INVOKE CLIENT CODE ON THIS THREAD!
216 final MenuContainer getParent_NoClientCode() {
217 return parent;
218 }
219
220 /**
221 * @deprecated As of JDK version 1.1,
222 * programs should not directly manipulate peers.
223 */
224 @Deprecated
225 public MenuComponentPeer getPeer() {
226 return peer;
227 }
228
229 /**
230 * Gets the font used for this menu component.
231 * @return the font used in this menu component, if there is one;
232 * <code>null</code> otherwise
233 * @see java.awt.MenuComponent#setFont
234 */
235 public Font getFont() {
236 Font font = this.font;
237 if (font != null) {
238 return font;
239 }
240 MenuContainer parent = this.parent;
241 if (parent != null) {
242 return parent.getFont();
|
1 /*
2 * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
203 /**
204 * Returns the parent container for this menu component.
205 * @return the menu component containing this menu component,
206 * or <code>null</code> if this menu component
207 * is the outermost component, the menu bar itself
208 */
209 public MenuContainer getParent() {
210 return getParent_NoClientCode();
211 }
212 // NOTE: This method may be called by privileged threads.
213 // This functionality is implemented in a package-private method
214 // to insure that it cannot be overridden by client subclasses.
215 // DO NOT INVOKE CLIENT CODE ON THIS THREAD!
216 final MenuContainer getParent_NoClientCode() {
217 return parent;
218 }
219
220 /**
221 * @deprecated As of JDK version 1.1,
222 * programs should not directly manipulate peers.
223 * @return the peer for this component
224 */
225 @Deprecated
226 public MenuComponentPeer getPeer() {
227 return peer;
228 }
229
230 /**
231 * Gets the font used for this menu component.
232 * @return the font used in this menu component, if there is one;
233 * <code>null</code> otherwise
234 * @see java.awt.MenuComponent#setFont
235 */
236 public Font getFont() {
237 Font font = this.font;
238 if (font != null) {
239 return font;
240 }
241 MenuContainer parent = this.parent;
242 if (parent != null) {
243 return parent.getFont();
|