Closed tcr closed 13 years ago
Mug now has support for this using the java
module:
var java = require("java")
var JFrame = java.import("javax.swing.JFrame")
var JButton = java.import("javax.swing.JButton")
var frame = new JFrame("Window")
frame.add(new JButton("Click me"))
frame.setSize(200, 200)
frame.setVisible(true)
Which uses the reflection API. It will be worthwhile to write a specialized compiler that will hard-code references to a Java class in a JSObject to avoid the Reflection API overhead, as a second option.
This feature is not yet supported, but probably a requirement if Mug is to be used in any production environment.
The current workaround is to write modules which wrap Java functionality.