How to 'properly' extend javax.swing.JFrame with nashorn?

Christian MICHON christian.michon at
Tue Mar 3 08:27:41 UTC 2015


[ I tried to contact Sundar directly (still no answer), but I'd like to get
nashorn devs opinion as well. ]

I'm currently trying to extend a javax.swing.JFrame to make a small gui
using nashorn.

When I'm doing this with java or jruby, it's straight forward and quite
easy to code a contructor of the derived class to customize dimensions for

Yet with nashorn I'm struggling: how is named the constructor?

I've a small snippet below to share: I'd like to know what is supposed to
be in place of XYZ to make frame appear properly (dimensions 800x600).

var myJFrame = Java.extend(javax.swing.JFrame, {
  XYZ: function() {
    setSize(800, 600);
var my = new myJFrame();

Thanks in advance.

More information about the nashorn-dev mailing list