-
Bug
-
Resolution: Fixed
-
P2
-
1.1.2
-
None
-
0.9internal
-
sparc
-
solaris_2.5.1
-
Verified
The following code shows that JListBox.removeSelectionInterval() does
not remove selections. It selects the indices that you want to have
removed and deselects the previously selected indices.
import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
public class listbox1
{
public static void main(String[] args)
{
String strings[] = { "zero", "one", "two", "three", "four" };
final JListBox listbox = new JListBox( strings );
JPanel p = new JPanel();
p.setLayout(new GridLayout(1,1));
p.add(listbox);
listbox.addSelectionInterval(0,1);
// bug: The following code deselects indices 0 and 1, and
// selects indices 2 and 3 instead.
listbox.removeSelectionInterval(2,3);
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);}
};
JFrame f = new JFrame("ListBox");
f.addWindowListener(l);
f.add(p);
f.pack();
f.show();
}
}
not remove selections. It selects the indices that you want to have
removed and deselects the previously selected indices.
import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
public class listbox1
{
public static void main(String[] args)
{
String strings[] = { "zero", "one", "two", "three", "four" };
final JListBox listbox = new JListBox( strings );
JPanel p = new JPanel();
p.setLayout(new GridLayout(1,1));
p.add(listbox);
listbox.addSelectionInterval(0,1);
// bug: The following code deselects indices 0 and 1, and
// selects indices 2 and 3 instead.
listbox.removeSelectionInterval(2,3);
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);}
};
JFrame f = new JFrame("ListBox");
f.addWindowListener(l);
f.add(p);
f.pack();
f.show();
}
}