-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
1.4.2
-
Fix Understood
-
x86
-
windows_2000
Name: jk109818 Date: 08/15/2003
A DESCRIPTION OF THE REQUEST :
Scenario: javax.swing.JOptionPane is used to display a choice from an Object[] of size 20+ and javax.swing.plaf.basic.BasicOptionPaneUI uses a JList/JScrollPane to display the choices with 10 visible rows.
If keys a-z are used to select a non-visible item then the item is not made visible. The selected item should be made visible.
JUSTIFICATION :
Makes JOptionPane more friendly to use with keyboard with 20+ options.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Ensure the item selected in the JList is always made visible.
e.g. in javax.swing.plaf.basic.BasicOptionPaneUI.getMessage() add something like:
list.addListSelectionListener(new javax.swing.event.ListSelectionListener()
{
public void valueChanged(ListSelectionEvent e)
{
JList list = (JList) e.getSource();
list.ensureIndexIsVisible(list.getSelectedIndex());
}
});
---------- BEGIN SOURCE ----------
import javax.swing.JOptionPane;
public class JOptionPaneTest
{
public static void main(String[] args)
{
String[] options = {"a","b","c","d","e","f","g","h","i","j","k","l","m",
"n","o","p","q","r","s","t","u","v","w","x","y","z"};
JOptionPane.showInputDialog(null,
"select a letter using keys a-z and note that it is not made visible",
"JOptionPaneTest",
JOptionPane.INFORMATION_MESSAGE,
null,
options,
options[0]);
}
}
---------- END SOURCE ----------
(Incident Review ID: 199222)
======================================================================