Example usage for javafx.stage Stage Stage

List of usage examples for javafx.stage Stage Stage

Introduction

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

Prototype

public Stage() 

Source Link

Document

Creates a new instance of decorated Stage .

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/*from   ww w .j av a  2  s.  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.java

@Override
public void start(final Stage primaryStage) {
    StackPane sp = new StackPane();
    Button btnOpen = new Button("Open Dialog");
    sp.getChildren().add(btnOpen);//  w w  w  .  j av  a2 s  . co  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();
}

From source file:com.toyota.carservice.config.config2.java

public Object newStage(Stage stage, Label lb, String load, String judul, boolean resize, StageStyle style,
        boolean maximized) {
    try {/*from   ww  w  .  j  a  v  a 2 s  .co  m*/
        Stage st = new Stage();
        stage = (Stage) lb.getScene().getWindow();
        FXMLLoader root = new FXMLLoader(getClass().getResource(load));

        Scene scene = new Scene(root.load());
        st.initStyle(style);
        st.setResizable(resize);
        st.setMaximized(maximized);
        st.setTitle(judul);
        st.setScene(scene);
        ApplicationContext appContex = config.getInstance().getApplicationContext();
        Resource resource = appContex.getResource("classpath:com/toyota/carservice/img/kallatoyota.png");
        st.getIcons().add(new Image(resource.getURI().toString()));
        st.show();
        stage.close();
        return root.getController();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:org.pdfsam.ui.commons.ClosePaneTest.java

@Override
protected Parent getRootNode() {
    victimStage = new Stage();
    ClosePane containerPane = new ClosePane();
    Scene scene = new Scene(containerPane);
    victimStage.setScene(scene);//w w w .j  av  a2s  . co  m
    Button button = new Button("show");
    button.setOnAction(a -> victimStage.show());
    return button;
}

From source file:mesclasses.objects.LoadWindow.java

public LoadWindow(Stage stage, List<AppTask> tasks) {
    tasks.forEach(t -> {//w  ww. j a v a 2  s.  co m
        services.add(new LoadingService(t));
    });
    dialogStage = new Stage();
    dialogStage.setTitle("Chargement");
    dialogStage.initModality(Modality.WINDOW_MODAL);
    dialogStage.initOwner(stage);
    dialogStage.setScene(createloadingScene());
    LOG.info("LOAD WINDOW REQUESTED. tasks = " + StringUtils.join(getTaskNames(), ","));

}

From source file:net.sf.anathema.framework.presenter.action.about.AnathemaAboutAction.java

private Stage initializeDialogStage(Scene scene) {
    final Stage aboutStage = new Stage();
    aboutStage.initStyle(StageStyle.UNDECORATED);
    aboutStage.initOwner(stage);/*w ww . ja  v a  2  s  .co  m*/
    aboutStage.setResizable(false);
    aboutStage.setTitle(resources.getString("Help.AboutDialog.Title"));
    aboutStage.setScene(scene);
    initCloseOnEscape(aboutStage);
    return aboutStage;
}

From source file:fx.DownloadFxApp.java

public static void launchUI() {
    Platform.runLater(new Runnable() {
        @Override/* w  w w  . j ava  2s . com*/
        public void run() {
            new DownloadFxApp().createScene(new Stage());
        }
    });
}

From source file:gui.accessories.GraphPopup.java

private void initFX(JFXPanel fxPanel) {
    // This method is invoked on the JavaFX thread
    Stage window = new Stage();
    window.initModality(Modality.APPLICATION_MODAL);
    window.setTitle(labels.getString("PONTOS.VITORIA"));
    window.setMinWidth(500);//from  w  w w.  j av  a2 s.  c  om

    Chart chart = createStackedBarChart();
    chart.setAnimated(true);
    Scene scene = new Scene(chart);

    //show and tell
    window.setScene(scene);
    window.showAndWait();

    fxPanel.setScene(scene);
}

From source file:com.heliosdecompiler.helios.gui.controller.PathEditorController.java

@FXML
private void initialize() {
    this.list.setCellFactory(TextFieldListCell.forListView());

    List<String> path = configuration.getList(String.class, Settings.PATH_KEY, Collections.emptyList());
    this.list.getItems().addAll(path);

    stage = new Stage();
    stage.setOnCloseRequest(event -> {
        event.consume();//from  w w w . j ava2s .  c om
        stage.hide();
        this.list.getItems().removeAll(Arrays.asList(null, ""));
        configuration.setProperty(Settings.PATH_KEY, this.list.getItems());
        eventBus.post(new PathUpdatedEvent());
        pathController.reload();
    });
    stage.setScene(new Scene(root));
    stage.getIcons().add(new Image(getClass().getResourceAsStream("/res/icon.png")));
    stage.setTitle("Edit Path");
}

From source file:gmailclientfx.controllers.LoginController.java

public void btnLogin_click(ActionEvent e) {
    if (!txtEmail.getText().equals("")) {
        String email = txtEmail.getText();
        if (EmailValidator.getInstance().isValid(email)) {
            User user = User.getUserByEmail(email);

            if (!(user == null)) {
                try {

                    GmailClient.setRefreshToken(user.getRefreshToken());
                    GmailClient.refreshAccessToken();

                    Parent loginStage = txtEmail.getParent();
                    loginStage.getScene().getWindow().hide();
                    Parent root;/*from   w  ww  .j  a v a 2  s  .c om*/
                    root = FXMLLoader
                            .load(getClass().getClassLoader().getResource("gmailclientfx/views/Home.fxml"));
                    Stage stage = new Stage();
                    stage.setTitle("Home");
                    stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
                        @Override
                        public void handle(WindowEvent e) {
                            Platform.exit();
                            System.exit(0);

                        }
                    });
                    stage.setScene(new Scene(root));
                    stage.show();
                } catch (IOException ex) {
                    Logger.getLogger(LoginController.class.getName()).log(Level.SEVERE, null, ex);
                }

            } else {
                try {
                    GmailClient.authorizeUser();
                    String noviEmail = GmailClient.getEmail();
                    String noviRefreshToken = GmailClient.getRefreshToken();
                    User u = User.getUserByEmail(noviEmail);

                    if (u == null) {
                        User.unesiUseraUBazu(new User(noviEmail, noviRefreshToken));
                    }

                    Parent loginStage = txtEmail.getParent();
                    loginStage.getScene().getWindow().hide();
                    Parent root;
                    root = FXMLLoader
                            .load(getClass().getClassLoader().getResource("gmailclientfx/views/Home.fxml"));
                    Stage stage = new Stage();
                    stage.setTitle("Home");
                    stage.setScene(new Scene(root));
                    stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
                        @Override
                        public void handle(WindowEvent e) {
                            Platform.exit();
                            System.exit(0);

                        }
                    });
                    stage.show();

                } catch (IOException ex) {
                    Logger.getLogger(LoginController.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        } else {
            lblStatusMsg.setText("Uneseni email nije validan!");
        }
    } else {
        lblStatusMsg.setText("Unesite email!");
    }
}