src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java

Print this page

        

*** 448,458 **** .getInitialSelectionValue(); JComponent toAdd; if (sValues != null) { if (sValues.length < 20) { ! JComboBox cBox = new JComboBox(); cBox.setName("OptionPane.comboBox"); for(int counter = 0, maxCounter = sValues.length; counter < maxCounter; counter++) { cBox.addItem(sValues[counter]); --- 448,458 ---- .getInitialSelectionValue(); JComponent toAdd; if (sValues != null) { if (sValues.length < 20) { ! JComboBox<Object> cBox = new JComboBox<>(); cBox.setName("OptionPane.comboBox"); for(int counter = 0, maxCounter = sValues.length; counter < maxCounter; counter++) { cBox.addItem(sValues[counter]);
*** 462,472 **** } inputComponent = cBox; toAdd = cBox; } else { ! JList list = new JList(sValues); JScrollPane sp = new JScrollPane(list); sp.setName("OptionPane.scrollPane"); list.setName("OptionPane.list"); list.setVisibleRowCount(10); --- 462,472 ---- } inputComponent = cBox; toAdd = cBox; } else { ! JList<Object> list = new JList<>(sValues); JScrollPane sp = new JScrollPane(list); sp.setName("OptionPane.scrollPane"); list.setName("OptionPane.list"); list.setVisibleRowCount(10);
*** 1230,1240 **** public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { if (e.getClickCount() == 2) { ! JList list = (JList)e.getSource(); int index = list.locationToIndex(e.getPoint()); optionPane.setInputValue(list.getModel().getElementAt(index)); optionPane.setValue(JOptionPane.OK_OPTION); } --- 1230,1240 ---- public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { if (e.getClickCount() == 2) { ! JList<?> list = (JList)e.getSource(); int index = list.locationToIndex(e.getPoint()); optionPane.setInputValue(list.getModel().getElementAt(index)); optionPane.setValue(JOptionPane.OK_OPTION); }