< prev index next >
src/java.desktop/share/classes/java/awt/List.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2018, 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
@@ -150,11 +150,11 @@
*
* @serial
* @see #getSelectedIndexes()
* @see #getSelectedIndex()
*/
- int selected[] = new int[0];
+ int[] selected = new int[0];
/**
* This variable contains the value that will be used
* when trying to make a particular list item visible.
*
@@ -319,11 +319,11 @@
* @see #deselect
* @see #isIndexSelected
* @since 1.1
*/
public synchronized String[] getItems() {
- String itemCopies[] = new String[items.size()];
+ String[] itemCopies = new String[items.size()];
items.copyInto(itemCopies);
return itemCopies;
}
/**
@@ -486,11 +486,11 @@
* @see #select
* @see #deselect
* @see #isIndexSelected
*/
public synchronized int getSelectedIndex() {
- int sel[] = getSelectedIndexes();
+ int[] sel = getSelectedIndexes();
return (sel.length == 1) ? sel[0] : -1;
}
/**
* Gets the selected indexes on the list.
@@ -532,12 +532,12 @@
* @see #select
* @see #deselect
* @see #isIndexSelected
*/
public synchronized String[] getSelectedItems() {
- int sel[] = getSelectedIndexes();
- String str[] = new String[sel.length];
+ int[] sel = getSelectedIndexes();
+ String[] str = new String[sel.length];
for (int i = 0 ; i < sel.length ; i++) {
str[i] = getItem(sel[i]);
}
return str;
}
@@ -600,11 +600,11 @@
if (!alreadySelected) {
if (!multipleMode) {
selected = new int[1];
selected[0] = index;
} else {
- int newsel[] = new int[selected.length + 1];
+ int[] newsel = new int[selected.length + 1];
System.arraycopy(selected, 0, newsel, 0,
selected.length);
newsel[selected.length] = index;
selected = newsel;
}
@@ -634,11 +634,11 @@
}
}
for (int i = 0 ; i < selected.length ; i++) {
if (selected[i] == index) {
- int newsel[] = new int[selected.length - 1];
+ int[] newsel = new int[selected.length - 1];
System.arraycopy(selected, 0, newsel, 0, i);
System.arraycopy(selected, i+1, newsel, i, selected.length - (i+1));
selected = newsel;
return;
}
@@ -667,11 +667,11 @@
* @deprecated As of JDK version 1.1,
* replaced by {@code isIndexSelected(int)}.
*/
@Deprecated
public boolean isSelected(int index) {
- int sel[] = getSelectedIndexes();
+ int[] sel = getSelectedIndexes();
for (int i = 0 ; i < sel.length ; i++) {
if (sel[i] == index) {
return true;
}
}
@@ -1491,11 +1491,11 @@
* Clears the selection in the object, so that nothing in the
* object is selected.
*/
public void clearAccessibleSelection() {
synchronized(List.this) {
- int selectedIndexes[] = List.this.getSelectedIndexes();
+ int[] selectedIndexes = List.this.getSelectedIndexes();
if (selectedIndexes == null)
return;
for (int i = selectedIndexes.length - 1; i >= 0; i--) {
List.this.deselect(selectedIndexes[i]);
}
< prev index next >