如何从 javascript/rhino 调用具有整数和浮点数的重载 java 方法?
例如,如何从 javascript/rhino 调用 java java.awt.Color(int,int,int) 构造函数?我已经处理了下一个片段但不起作用:
var Integer = java.lang.Integer;
var color = new java.awt.Color(12,58,92); // it invokes java.awt.Color(float,float,float) and throws Wrapped java.lang.IllegalArgumentException: Color parameter outside of expected range: Red Green Blue.
var color = new java.awt.Color(new Integer(12), new Integer(58), new Integer(92) // it invokes java.awt.Color(float,float,float) and throws exception
var color = new Color(Integer.valueOf(12),Integer.valueOf(200),Integer.valueOf(80)); // it invokes java.awt.Color(float,float,float) and throws exception