1

似乎有多种方法可以将参数传递给 JavaFX 应用程序。

这将使 arg_# 的键值对及其值可访问。

<script src="http://dl.javafx.com/1.1/dtfx.js"></script>
<script>
    javafx(
        {
              archive: "JavaFXApplication.jar",
              width: 1014,
              height: 1024,
              code: "javafxapplication.TestMain",
              name: "JavaFXApplication"
              arg_1: "value1",
              arg_2: "value2"
        }

    );
</script>

上面的代码是有效的。下面的代码提供了完全相同的功能。

<script src="http://dl.javafx.com/1.1/dtfx.js"></script>
<script>
    javafx(
        {
              archive: "JavaFXApplication.jar",
              width: 1014,
              height: 1024,
              code: "javafxapplication.TestMain",
              name: "JavaFXApplication"
        },
        {
              arg_1: "value1",
              arg_2: "value2"
        }

    );
</script>

但是我能得到什么来包围这些对。

这行得通吗?

<script src="http://dl.javafx.com/1.1/dtfx.js"></script>
<script>
    javafx(
        {
              archive: "JavaFXApplication.jar",
              width: 1014,
              height: 1024,
              code: "javafxapplication.TestMain",
              name: "JavaFXApplication"
        },
        {
              arg_1: "value1",
              arg_2: "value2"
        },
        {
              arg_1: "value3",
              arg_2: "value4"
        }

    );

我可以区分重复的键值对吗?

4

1 回答 1

0

看起来这是这样做的合乎逻辑的方法......

package readparam;

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;

Stage {
    width: 250
    height: 250
    scene: Scene {
        content: [
            Text {
                x: 10
                y: 30
                content: "param: xml:{FX.getArgument("xml")}"
            }
        ]
    }
}

.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>readParam</title>
</head>
<body>
<script src="http://dl.javafx.com/1.2/dtfx.js"></script>
<script>
    javafx(
        {
              archive: "readParam.jar",
              width: 300,
              height: 300,
              code: "readparam.Main",
              name: "readParam"
        },
        {
              xml: "<a><b/><c id='1'>blah</c></a>"
        }
    );
</script>
</body>
</html>
于 2009-09-21T18:42:53.453 回答