
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

/**
 * JavaFX App
 */
public class App extends Application {

    @Override
    public void start(Stage stage) {
        var policy = App.class.getResource("demo.policy");
        System.setProperty(
                "java.security.policy",
                policy.toString());
        System.setSecurityManager(new SecurityManager());

        try {
            getHostServices().showDocument("irrelevant");

            var label = new Label("Should not see this");
            var scene = new Scene(new StackPane(label), 640, 480);
            stage.setScene(scene);
            stage.show();
        } catch (Exception e) {
            var label = new Label("Should see this");
            var scene = new Scene(new StackPane(label), 640, 480);
            stage.setScene(scene);
            stage.show();
        }
    }

    public static void main(String[] args) {
        launch();
    }
} 