1 /*
2 * Copyright (c) 2002, 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
148 public void dispose() {
149 //Empty function
150 }
151
152 public void setFont(Font font) {
153 resetTextMetrics();
154 repaintIfShowing();
155 }
156 /*
157 * From MenuItemPeer
158 */
159 public void setLabel(String label) {
160 resetTextMetrics();
161 repaintIfShowing();
162 }
163
164 public void setEnabled(boolean enabled) {
165 repaintIfShowing();
166 }
167
168 /**
169 * DEPRECATED: Replaced by setEnabled(boolean).
170 * @see java.awt.peer.MenuItemPeer
171 */
172 public void enable() {
173 setEnabled( true );
174 }
175
176 /**
177 * DEPRECATED: Replaced by setEnabled(boolean).
178 * @see java.awt.peer.MenuItemPeer
179 */
180 public void disable() {
181 setEnabled( false );
182 }
183
184 /************************************************
185 *
186 * Access to target's fields
187 *
188 ************************************************/
189
190 MenuItem getTarget() {
191 return this.target;
192 }
193
194 Font getTargetFont() {
195 if (target == null) {
196 return XWindow.getDefaultFont();
197 }
198 return AWTAccessor.getMenuComponentAccessor().getFont_NoClientCode(target);
199 }
200
201 String getTargetLabel() {
202 if (target == null) {
203 return "";
|
1 /*
2 * Copyright (c) 2002, 2018, 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
148 public void dispose() {
149 //Empty function
150 }
151
152 public void setFont(Font font) {
153 resetTextMetrics();
154 repaintIfShowing();
155 }
156 /*
157 * From MenuItemPeer
158 */
159 public void setLabel(String label) {
160 resetTextMetrics();
161 repaintIfShowing();
162 }
163
164 public void setEnabled(boolean enabled) {
165 repaintIfShowing();
166 }
167
168 /************************************************
169 *
170 * Access to target's fields
171 *
172 ************************************************/
173
174 MenuItem getTarget() {
175 return this.target;
176 }
177
178 Font getTargetFont() {
179 if (target == null) {
180 return XWindow.getDefaultFont();
181 }
182 return AWTAccessor.getMenuComponentAccessor().getFont_NoClientCode(target);
183 }
184
185 String getTargetLabel() {
186 if (target == null) {
187 return "";
|