-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.3.1, 1.4.0
-
generic, sparc
-
generic, solaris_8
Name: bsC130419 Date: 05/10/2001
java version "1.3.1-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-beta-b15)
Java HotSpot(TM) Client VM (build 1.3.1beta-b15, interpreted mode)
JList does not scroll to selected item for setSelectedValue(value, true), but
the item is selected, as can be seen if the user scrolls manually. The attached
code works correctly run under 1.2.2, but does not scroll under 1.3.0 or 1.3.1.
import java.awt.*;
import javax.swing.*;
public class JListBug {
public static void main(String args[]) {
JFrame jFrame = new JFrame();
JPanel jPanel = new JPanel();
JScrollPane jScrollPane;
String[] names = { "aaaaa", "bbbbb", "ccccc", "ddddd", "eeeee", "fffff",
"ggggg", "hhhhh", "iiiii", "jjjjj", "kkkkk", "lllll",
"mmmmm", "nnnnn", "ooooo", "ppppp", "qqqqq", "rrrrr",
"sssss", "ttttt", "uuuuu", "vvvvv", "wwwww", "xxxxx",
"yyyyy", "zzzzz" };
JList jList = new JList(names);
jScrollPane = new JScrollPane(jList);
jPanel.setLayout(new GridBagLayout());
jPanel.add(jScrollPane,
new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER,
GridBagConstraints.NONE,
new Insets(0, 0, 0, 0),
0, 0));
jList.setSelectedValue("xxxxx", true); // <---<< Neither of these
jList.ensureIndexIsVisible(23); // <---<< work under 1.3.0
jFrame.getContentPane().add(jPanel);
jFrame.pack();
jFrame.setVisible(true);
}
}
(Review ID: 124124)
======================================================================
- duplicates
-
JDK-4457326 JList setSelectedValue(value, true) does not scroll
-
- Closed
-
-
JDK-4337516 JComboBox popup doesn't initially display selected item
-
- Resolved
-