I've an issue with nashorn where i want to extend the JFrame
instance.
The following code
print(Object.isExtensible(frame));
Where frame
is the instance. Well this line throws a TypeError
, while :
Object.prototype.toString.call(frame)
returns [Object javax.swing.JFrame]
meaning it is an object whose constructor is javax.swing.JFrame
.
I'm confused and would like some suggestion.
Java objects by themselves are not extensible (JavaScript objects are.)
You have two options: