0

I'm just beginning out with Apache Pivot and started with Hello BXML example on their site. The applet just displays a grey rectangle and nothing more. I've deployed the application under tomcat with following structure: hellopivot

  • lib/pivot-*.jar
  • org.apache.pivot.tutorials.HelloBxml
  • scripts/deployJava.js
  • index.html
  • hello.bxml

index.html:

<script type="text/javascript">var attributes = {
            code : "org.apache.pivot.wtk.BrowserApplicationContext$HostApplet",
            width : "240",
            height : "80"
    };

        var libraries = [];
        libraries.push("lib/pivot-core-2.0.jar");
        libraries.push("lib/pivot-wtk-2.0.jar");
        libraries.push("lib/pivot-wtk-terra-2.0.jar");
        libraries.push("lib/pivot-web-2.0.jar");
        libraries.push("lib/pivot-web-server-2.0.jar");

        attributes.archive = libraries.join(",");

        var parameters = {
            codebase_lookup : false,
            application_class_name : 'org.apache.pivot.tutorials.HelloBxml'
        };

        var javaArguments = [ "-Dsun.awt.noerasebackground=true",
                "-Dsun.awt.erasebackgroundonresize=true" ];

        parameters.java_arguments = javaArguments.join(" ");

        deployJava.runApplet(attributes, parameters, "1.6");
</script>

hello.bxml

<Window title="Hello BXML!" maximized="true"
    xmlns:bxml="http://pivot.apache.org/bxml"
    xmlns="org.apache.pivot.wtk">
    <Label text="Hello BXML!"
        styles="{font:'Arial bold 24', color:'#ff0000',
            horizontalAlignment:'center', verticalAlignment:'center'}"/>
</Window>

HelloBxml.java

@Override
    public void startup(Display display, Map<String, String> properties)
            throws Exception {
        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        window = (Window)bxmlSerializer.readObject(HelloBxml.class, "hello.bxml");
        window.open(display);
    }

What am I doing wrong?

4

2 回答 2

0

(披露 - Apache Pivot PMC 成员)

您如何尝试查看小程序?
您使用的是哪个操作系统、JVM、浏览器等?

您是否能够使用与失败的“本地”版本相同的客户端配置查看该小程序的托管版本? Apache Pivot 官方网站上的 HelloBXML

您在查看官方网站上托管的任何其他 Pivot 小程序时是否有问题?(演示或教程?)

据报道,Linux 环境中的小程序问题听起来与您的经历相似。

于 2012-03-31T13:17:38.450 回答
0

尝试将“lib/pivot-tutorials-2.0.jar”添加到您的库列表中。这就是 'org.apache.pivot.tutorials.HelloBxml' 类文件所在的位置。

于 2014-12-09T18:16:09.380 回答