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

Print this page

        

*** 98,108 **** return oldValue; } else { // Must take the value from the editor and get the value and cast it to the new type. Class<?> cls = oldValue.getClass(); try { ! Method method = MethodUtil.getMethod(cls, "valueOf", new Class[]{String.class}); newValue = MethodUtil.invoke(method, oldValue, new Object[] { editor.getText()}); } catch (Exception ex) { // Fail silently and return the newValue (a String object) } } --- 98,108 ---- return oldValue; } else { // Must take the value from the editor and get the value and cast it to the new type. Class<?> cls = oldValue.getClass(); try { ! Method method = MethodUtil.getMethod(cls, "valueOf", new Class<?>[]{String.class}); newValue = MethodUtil.invoke(method, oldValue, new Object[] { editor.getText()}); } catch (Exception ex) { // Fail silently and return the newValue (a String object) } }