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
197 }
198 super.removeNotify();
199 }
200 }
201
202 /**
203 * Indicates whether this menu is a tear-off menu.
204 * <p>
205 * Tear-off functionality may not be supported by all
206 * implementations of AWT. If a particular implementation doesn't
207 * support tear-off menus, this value is silently ignored.
208 * @return <code>true</code> if this is a tear-off menu;
209 * <code>false</code> otherwise.
210 */
211 public boolean isTearOff() {
212 return tearOff;
213 }
214
215 /**
216 * Get the number of items in this menu.
217 * @return the number of items in this menu.
218 * @since JDK1.1
219 */
220 public int getItemCount() {
221 return countItems();
222 }
223
224 /**
225 * @deprecated As of JDK version 1.1,
226 * replaced by <code>getItemCount()</code>.
227 */
228 @Deprecated
229 public int countItems() {
230 return countItemsImpl();
231 }
232
233 /*
234 * This is called by the native code, so client code can't
235 * be called on the toolkit thread.
236 */
237 final int countItemsImpl() {
238 return items.size();
239 }
240
241 /**
242 * Gets the item located at the specified index of this menu.
243 * @param index the position of the item to be returned.
244 * @return the item located at the specified index.
|
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
197 }
198 super.removeNotify();
199 }
200 }
201
202 /**
203 * Indicates whether this menu is a tear-off menu.
204 * <p>
205 * Tear-off functionality may not be supported by all
206 * implementations of AWT. If a particular implementation doesn't
207 * support tear-off menus, this value is silently ignored.
208 * @return <code>true</code> if this is a tear-off menu;
209 * <code>false</code> otherwise.
210 */
211 public boolean isTearOff() {
212 return tearOff;
213 }
214
215 /**
216 * Get the number of items in this menu.
217 *
218 * @return the number of items in this menu
219 * @since JDK1.1
220 */
221 public int getItemCount() {
222 return countItems();
223 }
224
225 /**
226 * Returns the number of items in this menu.
227 *
228 * @return the number of items in this menu
229 * @deprecated As of JDK version 1.1,
230 * replaced by <code>getItemCount()</code>.
231 */
232 @Deprecated
233 public int countItems() {
234 return countItemsImpl();
235 }
236
237 /*
238 * This is called by the native code, so client code can't
239 * be called on the toolkit thread.
240 */
241 final int countItemsImpl() {
242 return items.size();
243 }
244
245 /**
246 * Gets the item located at the specified index of this menu.
247 * @param index the position of the item to be returned.
248 * @return the item located at the specified index.
|