Example usage for javafx.scene Group Group

List of usage examples for javafx.scene Group Group

Introduction

In this page you can find the example usage for javafx.scene Group Group.

Prototype

public Group(Collection<Node> children) 

Source Link

Document

Constructs a group consisting of the given children.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {

    Button openURLButton = new Button("Go!");
    openURLButton.setOnAction(e -> {//  w w  w.j  av  a  2s  .c o  m
        HostServices host = getHostServices();
        JSObject js = host.getWebContext();
        if (js == null) {
            Stage s = new Stage(StageStyle.UTILITY);
            s.initModality(Modality.WINDOW_MODAL);
            Label msgLabel = new Label("This is an FX alert!");
            Group root = new Group(msgLabel);
            Scene scene = new Scene(root);
            s.setScene(scene);
            s.setTitle("FX Alert");
            s.show();
        } else {
            js.eval("window.alert('This is a JavaScript alert!')");
        }
    });

    Scene scene = new Scene(openURLButton);
    stage.setScene(scene);
    stage.setTitle("Knowing the Host");
    stage.show();
}