views:

40

answers:

1

There seems to be multiple ways to pass parameters to a JavaFX application.

This will make the key value pairs for arg_# and their value accessible.

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

    );
</script>

The code above is valid. The code below provides the exact same functionality.

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

    );
</script>

But what do I get for bracketing the pairs.

Will this work?

<script src="http://dl.javafx.com/1.1/dtfx.js"&gt;&lt;/script&gt;
<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"
        }

    );

Can I distinguish between the repeating key value pairs?

A: 

Looks like this is the logical way to do this...

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"&gt;&lt;/script&gt;
<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>
dacracot