This is as far as I got
function JMColor(r,g,b) {
// the same as calling super()
var color = JavaAdapter(java.awt.Color, {
'': java.awt.Color,
});
// Do your contstructor stuff here
// return the object
return color;
}
var col = new JMColor(0.75,0.5,0.5);
// js: J
Joseph Montanez wrote:
> If your using the adapter with an empty javascript object then thats a
> no no.
That was just to simplify the example. In reality, I wanted to override
some methods.
> I just spent an hour actraully trying to figure this out maybe I am
> doing it wrong but it works.
>
>
My only question is why cant I extend java.awt.Color?
I tried JMColor.prototpe.foo = function () {
print('bar');
};
and JMColor.foo = function () {
print('bar');
};
On Mar 4, 12:21 am, Joseph Montanez wrote:
> I just spent an hour actraully trying to figure this out maybe I am
> doing
I just spent an hour actraully trying to figure this out maybe I am
doing it wrong but it works.
importPackage(java.awt);
function JMColor(r,g,b) {
// the same as calling super()
var color = JavaAdapter(Color(r,g,b));
// Do your contstructor stuff here
// return the object
re
If your using the adapter with an empty javascript object then thats a
no no.
Just use:
new JavaAdapter(javax.swing.OverlayLayout);
On Mar 3, 9:53 pm, Cameron McCormack wrote:
> [Reposted from m.d.t.js-engine where I mistakenly posted it first.]
>
> Hi.
>
> I want to, from script, extend a Java
[Reposted from m.d.t.js-engine where I mistakenly posted it first.]
Hi.
I want to, from script, extend a Java class that has no default
constructor. Specifically, I want to extend javax.swing.OverlayLayout
so that I can override some of its methods. I tried:
Rhino 1.7 release 3 PRERELEASE 20