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
235 this.multipleMode = multipleMode;
236 }
237
238 /**
239 * Construct a name for this component. Called by
240 * <code>getName</code> when the name is <code>null</code>.
241 */
242 String constructComponentName() {
243 synchronized (List.class) {
244 return base + nameCounter++;
245 }
246 }
247
248 /**
249 * Creates the peer for the list. The peer allows us to modify the
250 * list's appearance without changing its functionality.
251 */
252 public void addNotify() {
253 synchronized (getTreeLock()) {
254 if (peer == null)
255 peer = getToolkit().createList(this);
256 super.addNotify();
257 }
258 }
259
260 /**
261 * Removes the peer for this list. The peer allows us to modify the
262 * list's appearance without changing its functionality.
263 */
264 public void removeNotify() {
265 synchronized (getTreeLock()) {
266 ListPeer peer = (ListPeer)this.peer;
267 if (peer != null) {
268 selected = peer.getSelectedIndexes();
269 }
270 super.removeNotify();
271 }
272 }
273
274 /**
275 * Gets the number of items in the list.
|
1 /*
2 * Copyright (c) 1995, 2015, 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
235 this.multipleMode = multipleMode;
236 }
237
238 /**
239 * Construct a name for this component. Called by
240 * <code>getName</code> when the name is <code>null</code>.
241 */
242 String constructComponentName() {
243 synchronized (List.class) {
244 return base + nameCounter++;
245 }
246 }
247
248 /**
249 * Creates the peer for the list. The peer allows us to modify the
250 * list's appearance without changing its functionality.
251 */
252 public void addNotify() {
253 synchronized (getTreeLock()) {
254 if (peer == null)
255 peer = getComponentFactory().createList(this);
256 super.addNotify();
257 }
258 }
259
260 /**
261 * Removes the peer for this list. The peer allows us to modify the
262 * list's appearance without changing its functionality.
263 */
264 public void removeNotify() {
265 synchronized (getTreeLock()) {
266 ListPeer peer = (ListPeer)this.peer;
267 if (peer != null) {
268 selected = peer.getSelectedIndexes();
269 }
270 super.removeNotify();
271 }
272 }
273
274 /**
275 * Gets the number of items in the list.
|