提交 47ba2744 编写于 作者: M malenkov

8035188: KSS: javax.swing.plaf.basic.BasicComboBoxEditor

Reviewed-by: alexsch, serb
上级 6f3ee6c6
......@@ -32,6 +32,8 @@ import java.awt.event.*;
import java.lang.reflect.Method;
import sun.reflect.misc.MethodUtil;
/**
* The default editor for editable combo boxes. The editor is implemented as a JTextField.
*
......@@ -98,8 +100,8 @@ public class BasicComboBoxEditor implements ComboBoxEditor,FocusListener {
// 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 = cls.getMethod("valueOf", new Class[]{String.class});
newValue = method.invoke(oldValue, new Object[] { editor.getText()});
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)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册