Example usage for javafx.stage Stage show

List of usage examples for javafx.stage Stage show

Introduction

In this page you can find the example usage for javafx.stage Stage show.

Prototype

@Override
public final void show() 

Source Link

Usage

From source file:Main.java

/**
 * Creates a popup containing error without any pretty things for a graphical way to show errors
 * @param error Error string to show//  w  ww . j av a  2s.c  o m
 */
public static void showError(String error) {
    if (Platform.isFxApplicationThread()) {
        Stage s = new Stage();
        VBox v = new VBox();
        v.getChildren().add(new Label("Error [" + error + ']'));
        Scene sc = new Scene(v);
        s.setTitle("Fail");
        s.setScene(sc);
        s.show();
    } else {
        Platform.runLater(() -> {
            Stage s = new Stage();
            VBox v = new VBox();
            v.getChildren().add(new Label("Error [" + error + ']'));
            Scene sc = new Scene(v);
            s.setTitle("Fail");
            s.setScene(sc);
            s.show();
        });
    }
}

From source file:main.TestManager.java

/**
 * Displays a screen on which teacher can create a new test.
 * @param stage current stage//from  w  ww  . java2  s  . c om
 */
public static void displayCreateNew(Stage stage) {
    try {
        Parent pane = FXMLLoader.load(TestManager.class.getResource("/resources/FXMLNewTest.fxml"));
        stage.setScene(new Scene(pane));
        stage.show();
    } catch (IOException e) {
        ErrorInformer.exitApp();
    }
}

From source file:jlotoprint.MainViewController.java

public static Stage loadTemplateChooser() {
    final Stage stage = new Stage();
    try {/*w w  w  . ja va 2  s .co  m*/
        FXMLLoader dialog = new FXMLLoader(MainViewController.class.getResource("TemplateDialog.fxml"));
        Parent root = (Parent) dialog.load();
        root.addEventHandler(TemplateDialogEvent.CANCELED, (actionEvent) -> {
            stage.close();
        });
        stage.setScene(new Scene(root));
        stage.setTitle("Choose a template");
        stage.getIcons().add(new Image("file:resources/icon.png"));
        stage.initModality(Modality.WINDOW_MODAL);
        stage.initOwner(JLotoPrint.stage.getScene().getWindow());
        stage.show();
    } catch (IOException ex) {
        Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex);
        return null;
    }
    return stage;
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("Hello JavaFX Application");
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("Depth Buffer");
    stage.setScene(makeScene());
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("Rotations");
    stage.setScene(makeScene());/*from   www . j a  va 2 s  .co  m*/
    stage.show();
    TimelineBuilder.create().cycleCount(Timeline.INDEFINITE).keyFrames(
            new KeyFrame(Duration.seconds(0), new KeyValue(translateZForNode1, -100), new KeyValue(angle, 0)),
            new KeyFrame(Duration.seconds(2), new KeyValue(translateZForNode1, 100), new KeyValue(angle, 180)),
            new KeyFrame(Duration.seconds(4), new KeyValue(translateZForNode1, -100), new KeyValue(angle, 360))

    ).build().play();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setScene(scene);/*  ww w .  j  av a 2s.  c  o  m*/
    stage.show();

    stage.setWidth(300);
    stage.setHeight(200);

    final String[] greetings = new String[] { "Hello", "Hola", "1", "2" };
    final ChoiceBox cb = new ChoiceBox(FXCollections.observableArrayList("1", "2", "3", "4"));
    cb.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
        public void changed(ObservableValue ov, Number value, Number new_value) {
            System.out.println(new_value.intValue());
        }
    });

    cb.setValue("2");
    HBox hb = new HBox();
    hb.getChildren().addAll(cb);
    hb.setSpacing(30);
    hb.setAlignment(Pos.CENTER);
    hb.setPadding(new Insets(10, 0, 0, 10));

    ((Group) scene.getRoot()).getChildren().add(hb);

}

From source file:Main.java

@Override
public void start(Stage stage) throws Exception {
    stage.setScene(new Scene(new Group(), 400, 100));
    stage.setTitle("Using Platform.runLater() Method");
    stage.show();
}

From source file:com.cdd.bao.editor.MainApplication.java

public void start(Stage primaryStage) {
    // open a main window: either a new schema or an existing one
    EditSchema edit = new EditSchema(primaryStage);
    for (String fn : getParameters().getUnnamed()) {
        File f = new File(fn);
        if (!f.exists()) {
            Util.writeln("File not found: " + f.getPath());
            return;
        }// w  w w .  j a va2 s  .c  om
        edit.loadFile(f);
        break;
    }

    final Stage stage = primaryStage;
    Platform.runLater(() -> stage.show());
}

From source file:Main.java

@Override
public void start(final Stage primaryStage) {
    StackPane sp = new StackPane();
    Button btnOpen = new Button("Open Dialog");
    sp.getChildren().add(btnOpen);/*from   www . j  a v  a 2s .  c o m*/

    btnOpen.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(ActionEvent event) {
            Stage stage = new Stage();
            Scene page2 = new Scene(new Group(new Text(20, 20, "This is a new dialog!")));
            stage.setScene(page2);
            stage.show();
        }
    });
    Scene scene = new Scene(sp, 300, 200);
    primaryStage.setScene(scene);
    primaryStage.show();
}