Hi all,

this question may be a bit far from the main js-engine-rhino topics. But
being unable to find a solution out there, I risk asking about it on this
forum. Sorry if it's the wrong place.
Usually I use Rhino for testing Java snippets, but with commonjs developing,
I more and more use it as a central platform.

I've been trying to launch a simple Apache Pivot application as E4X  makes a
lot easier to play with xml. So I guess functions could be easily inserted
into GUI...
There's a getting started tutorial on Pivot site (
http://pivot.apache.org/tutorials/hello-world.html) and this is somehow real
Java scripting for me, with interfaces, main...
I've coverted it into a function, but I OBVIOUSLY miss something and there
are errors. So if someone could comment out on this, I'd be happy!

So in this case, where to put main? What about arguments? String[] args ->
["arg1", "arg2"] ?
how to run?
HelloJava.main("HelloJava") throws
Can't find method
org.apache.pivot.wtk.DesktopApplicationContext.main(adapter1,string)

Thx,
jg

Code:
importPackage(org.apache.pivot.wtk,org.apache.pivot.collections, java.awt)

var HelloJava  = Application({
    //private Window window = null;
    window: null,

    startup: function(display, properties) {
        var label = new Label();
        label.setText("Hello World!");
        label.getStyles().put("font", new Font("Arial", Font.BOLD, 24));
        label.getStyles().put("color", Color.RED);
        label.getStyles().put("horizontalAlignment",
        HorizontalAlignment.CENTER);
        label.getStyles().put("verticalAlignment",
        VerticalAlignment.CENTER);

        window = new Window();
        window.setContent(label);
        window.setTitle("Hello World!");
        window.setMaximized(true);
        window.open(display);
    },
    shutdown: function(optional) {
        if (window != null) {
            window.close();
        }
        return false;
    },

    suspend: function() {},
    resume: function() {},

    main: function(args) {
        DesktopApplicationContext.main(HelloJava, "");
    }
})
_______________________________________________
dev-tech-js-engine-rhino mailing list
dev-tech-js-engine-rhino@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to