-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.3.0
-
x86
-
windows_nt
Name: yyT116575 Date: 12/19/2000
java version "1.2.2"
Classic VM (build JDK-1.2.2_006, native threads, symcjit)
JOptionPane
public static Object showInputDialog(Component parentComponent,
Object message,
String title,
int messageType,
Icon icon,
Object[] selectionValues,
Object initialSelectionValue)
When the selectionValues[] size is 19 or less, the drop down combobox in the
JOptionPane.showInputDialog appears as a drop down
with one arrow pointing down, where the user has the flexibility of picking up
any of the values just by clicking on the
down arrow and choosing one.
When the array size is 20 or more, the drop down combobox in the
JOptionPane.showInputDialog appears as a drop down
with two arrows, one poinitng up and another pointing down, where the user has
to not only click on the up or down
arrows but also has to explicitly click on the shown value to really select it.
Can it be the case that if the user
just click on the arrows and whatever is visible can be the one which he wants
to select ?. The user need not always
click on the displayed one to really choose it.
This happens in the case of any of the browsers like InternetExplorer, and
Netscape or appletviewer.
Same is not the case when the JOptionPane is displayed in an IDE like Visual
Age, Forte, JBuilder, etc. If the selectionValues[] size is 19 or less, the
JOptionPane appears as a simple dropdown, but if the size is 20 or more, an
expanded bigger size combobox showing the entire list of
values appears.
Can there be a standard way of making the combo boxes in the JOptionPane
displayable same independent of whether we use
a browser, an appletviewer or an IDE, and can we have another additional
parameter in the showInputDialog which shall mention the size or
the displaying mode of the combo box on the JOptionPane, viz, a combobox with
two arrows, or one arrow, etc.
Can we also make a choice selected automatically(which shall be the one which
is the one displayed), and the user need
not explicitly click on the choice if we get both the arrows.
Below is the code which shows you the difference.(Please change i to 19 to see
the difference)
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.JOptionPane;
import java.util.*;
public class JOptionPaneTest extends javax.swing.JApplet implements
WindowListener {
public void init()
{
int i;
Vector selectionValues = new Vector();
try
{
for (i = 0; i < 20; i++)
{
selectionValues.add(new Integer(i));
}
Object selectedValue = JOptionPane.showInputDialog
(this.getContentPane(), "Selection Vales Size is " + i, "OptionPane ", 1, null,
selectionValues.toArray(), selectionValues.elementAt(0));
if (selectedValue != null)
System.out.println("Selected Value is " + selectedValue.toString());
}
catch (Exception e)
{
System.err.println("Exception " + e.getMessage());
}
}
public static void main(java.lang.String[] args)
{
JOptionPaneTest applet = new JOptionPaneTest();
Frame frame = new Frame("Applet");
frame.addWindowListener(applet);
frame.add("Center", applet);
frame.setSize(350, 250);
frame.show();
applet.init();
applet.start();
}
public void paint(Graphics g) {
super.paint(g);
}
public void windowActivated(WindowEvent e)
{
}
public void windowClosed(WindowEvent e)
{
}
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
public void windowDeactivated(WindowEvent e)
{
}
public void windowDeiconified(WindowEvent e)
{
}
public void windowIconified(WindowEvent e)
{
}
public void windowOpened(WindowEvent e)
{
}
}
(Review ID: 114004)
======================================================================
- duplicates
-
JDK-4222531 JOptionPane layout broken when list used to display options
-
- Resolved
-