sayhello

 

スクリプト

sayhello.fx

import javafx.ext.swing.SwingButton;
import javafx.ext.swing.SwingLabel;
import javafx.ext.swing.SwingTextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.Scene;
import javafx.scene.text.Font;
import javafx.stage.Stage;
 
var who = "World";
var label = "Hello, World!";
 
Stage {
    title: "Say Hello to..."
    scene: Scene {
        width: 220
        height: 100
        content: [
            VBox {
                translateX: 10
                translateY: 10
                spacing: 10
                content: [
                    HBox {
                        spacing: 10
                        content: [
                            SwingTextField {
                                columns: 10
                                text: bind who with inverse
                                editable: true
                            },
                            SwingButton {
                                text: "Update"
                                action: function() {
                                    label = "Hello, {who}!"
                                }
                            }
                        ]
                    },
                    SwingLabel {
                        font: Font {
                            size: 24
                        }
                        width:200
                        text: bind label
                    }
                ]
            }
        ]
    }
 }