src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java
Print this page
@@ -448,11 +448,11 @@
.getInitialSelectionValue();
JComponent toAdd;
if (sValues != null) {
if (sValues.length < 20) {
- JComboBox cBox = new JComboBox();
+ JComboBox<Object> cBox = new JComboBox<>();
cBox.setName("OptionPane.comboBox");
for(int counter = 0, maxCounter = sValues.length;
counter < maxCounter; counter++) {
cBox.addItem(sValues[counter]);
@@ -462,11 +462,11 @@
}
inputComponent = cBox;
toAdd = cBox;
} else {
- JList list = new JList(sValues);
+ JList<Object> list = new JList<>(sValues);
JScrollPane sp = new JScrollPane(list);
sp.setName("OptionPane.scrollPane");
list.setName("OptionPane.list");
list.setVisibleRowCount(10);
@@ -1230,11 +1230,11 @@
public void mouseExited(MouseEvent e) {
}
public void mousePressed(MouseEvent e) {
if (e.getClickCount() == 2) {
- JList list = (JList)e.getSource();
+ JList<?> list = (JList)e.getSource();
int index = list.locationToIndex(e.getPoint());
optionPane.setInputValue(list.getModel().getElementAt(index));
optionPane.setValue(JOptionPane.OK_OPTION);
}