Example usage for javafx.stage Stage setTitle

List of usage examples for javafx.stage Stage setTitle

Introduction

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

Prototype

public final void setTitle(String value) 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    AreaChart areaChart = new AreaChart(xAxis, yAxis, getChartData());

    areaChart.setTitle("speculations");
    primaryStage.setTitle("AreaChart example");

    StackPane root = new StackPane();
    root.getChildren().add(areaChart);/*from  ww  w .j av  a2 s  .  com*/
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.show();
}

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;/* w w w  .j a va2  s  .  com*/
                    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!");
    }
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Button btn = new Button("Hello JavaFX!");

    HBox root = new HBox();
    root.getChildren().addAll(btn);//from  w w w  .ja v a 2s  . c o  m

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Sizes of a Node");
    stage.show();

    btn.setWrapText(true);
    btn.setPrefWidth(80);
    stage.sizeToScene();

    System.out.println("btn.getContentBias() = " + btn.getContentBias());

    System.out.println(
            "btn.getPrefWidth() = " + btn.getPrefWidth() + ", btn.getPrefHeight() = " + btn.getPrefHeight());

    System.out.println(
            "btn.getMinWidth() = " + btn.getMinWidth() + ", btn.getMinHeight() = " + btn.getMinHeight());

    System.out.println(
            "btn.getMaxWidth() = " + btn.getMaxWidth() + ", btn.getMaxHeight() = " + btn.getMaxHeight());

    double prefWidth = btn.prefWidth(-1);
    System.out.println(
            "btn.prefWidth(-1) = " + prefWidth + ", btn.prefHeight(prefWidth) = " + btn.prefHeight(prefWidth));

    double minWidth = btn.minWidth(-1);
    System.out.println(
            "btn.minWidth(-1) = " + minWidth + ", btn.minHeight(minWidth) = " + btn.minHeight(minWidth));

    double maxWidth = btn.maxWidth(-1);
    System.out.println(
            "btn.maxWidth(-1) = " + maxWidth + ", btn.maxHeight(maxWidth) = " + btn.maxHeight(maxWidth));

    System.out.println("btn.getWidth() = " + btn.getWidth() + ", btn.getHeight() = " + btn.getHeight());
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Button exitBtn = new Button("Exit");
    exitBtn.setOnAction(e -> Platform.exit());

    VBox root = new VBox();
    root.getChildren().add(exitBtn);/*from w  w  w . ja v a  2s . c om*/

    Scene scene = new Scene(root, 300, 50);
    stage.setScene(scene);
    stage.setTitle("Hello JavaFX Application with a Scene");
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    String yahooURL = "http://www.java2s.com";
    Button openURLButton = new Button("Go!");
    openURLButton.setOnAction(e -> getHostServices().showDocument(yahooURL));

    Scene scene = new Scene(openURLButton);
    stage.setScene(scene);/* w w  w. ja  v a  2s .  co m*/
    stage.setTitle("Knowing the Host");
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Arc arc = new Arc(0, 0, 50, 100, 0, 90);
    arc.setFill(Color.GRAY);/*from   ww  w .  ja  v a2 s .  c om*/
    arc.setStroke(Color.BLACK);
    arc.setType(ArcType.ROUND);

    HBox box = new HBox(arc);

    Scene scene = new Scene(box);
    stage.setScene(scene);
    stage.setTitle("Test");
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    BarChart barChart = new BarChart(xAxis, yAxis, getChartData());
    barChart.setBarGap(0.2);//from  w  ww . j  a  va  2  s .com
    barChart.setTitle("A");
    primaryStage.setTitle("BarChart example");

    StackPane root = new StackPane();
    root.getChildren().add(barChart);
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    LineChart lineChart = new LineChart(xAxis, yAxis);
    lineChart.setData(getChartData());/*from   w w  w. j  a va2  s.  c o m*/
    lineChart.setTitle("Chart");
    primaryStage.setTitle("LineChart example");

    StackPane root = new StackPane();
    root.getChildren().add(lineChart);
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.show();
}

From source file:com.coolchick.translatortemplater.Main.java

/**
 * Opens a dialog to edit details for the specified person. If the user clicks OK, the changes
 * are saved into the provided person object and true is returned.
 *
 * @param person the person object to be edited
 * @return true if the user clicked OK, false otherwise.
 *///from  ww w . java2 s  . c  o m
public boolean showTranslatorEditDialog(Translator person) {
    try {
        // Load the fxml file and create a new stage for the popup dialog.
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(Main.class.getResource("PersonEditDialog.fxml"));
        AnchorPane page = (AnchorPane) loader.load();
        // Create the dialog Stage.
        Stage dialogStage = new Stage();
        dialogStage.setTitle("Edit Person");
        dialogStage.initModality(Modality.WINDOW_MODAL);
        dialogStage.initOwner(primaryStage);
        Scene scene = new Scene(page);
        dialogStage.setScene(scene);
        // Set the person into the controller.
        PersonEditDialogController controller = loader.getController();
        controller.setDialogStage(dialogStage);
        controller.setMain(this);
        controller.setTranslator(person);
        // Show the dialog and wait until the user closes it
        dialogStage.showAndWait();
        return controller.isOkClicked();
    } catch (IOException e) {
        e.printStackTrace();
        return false;
    }
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    BarChart barChart = new BarChart(xAxis, yAxis, getChartData());
    barChart.setCategoryGap(0.2);/* w  ww  . j  av a  2 s  . c o  m*/
    barChart.setTitle("A");
    primaryStage.setTitle("BarChart example");

    StackPane root = new StackPane();
    root.getChildren().add(barChart);
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.show();
}