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:aajavafx.VisitorController.java

@FXML
private void handleGoBack(ActionEvent event) {
    try {//from ww w  .j  a  v a2  s .  c  o  m
        Node node = (Node) event.getSource();
        Stage stage = (Stage) node.getScene().getWindow();
        FXMLLoader loader = new FXMLLoader(getClass().getResource("MainPage.fxml"));
        Parent root = loader.load();
        Scene scene = new Scene(root, 879, 599);
        stage.setScene(scene);

        stage.setTitle("Main menu");
        stage.show();

    } catch (Exception ex) {
        Logger.getLogger(MainPageController.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:investiagenofx2.view.InvestiaGenOFXController.java

private void showInvestmentsSummary(String accountType, Double x, Double y) {
    try {//from w w  w.  j  ava  2s .co  m
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(InvestiaGenOFX.class.getResource("view/investmentsSummary.fxml"));
        AnchorPane page = (AnchorPane) loader.load();

        Stage dialogStage = new Stage();
        dialogStage.setTitle("Sommaire des Investissements " + accountType);
        dialogStage.getIcons().add(new Image("/myIcons/Teddy-Bear-Sick-icon.png"));
        dialogStage.initModality(Modality.NONE);
        Scene scene = new Scene(page);
        dialogStage.initOwner(InvestiaGenOFX.getPrimaryStage());
        dialogStage.setX(x);
        dialogStage.setY(y);
        dialogStage.setScene(scene);
        dialogStage.show();
    } catch (Exception ex) {
        Logger.getLogger(InvestiaGenOFXController.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:investiagenofx2.view.InvestiaGenOFXController.java

private void linkAccountTransac(String linkAccountTransac) {
    try {//from  w w w.ja v a 2  s. c  o  m
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(InvestiaGenOFX.class.getResource("view/linkaccountTransac.fxml"));
        AnchorPane page = (AnchorPane) loader.load();

        Stage dialogStage = new Stage();
        dialogStage.setTitle("Associer les comptes");
        dialogStage.getIcons().add(new Image("/myIcons/Teddy-Bear-Sick-icon.png"));
        dialogStage.initModality(Modality.WINDOW_MODAL);
        Scene scene = new Scene(page);
        dialogStage.initOwner(InvestiaGenOFX.getPrimaryStage());
        dialogStage.setScene(scene);
        InvestiaGenOFX.setOnCloseRequest(dialogStage);

        LinkaccountTransacController controller = loader.getController();
        controller.setlinkAccountTransac(linkAccountTransac);
        dialogStage.showAndWait();
    } catch (Exception ex) {
        Logger.getLogger(InvestiaGenOFXController.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:de.micromata.mgc.javafx.ControllerService.java

public <M, C extends AbstractModelController<M>> C loadAsWindow(AbstractMainWindow<?> mainWindow,
        Class<C> controllerClass, M model, String dialogTitle) {
    Pair<Pane, C> pair = loadControlWithModel(controllerClass, Pane.class, model, mainWindow);
    Stage stage = new Stage();
    stage.addEventHandler(WindowEvent.WINDOW_CLOSE_REQUEST, e -> {
        stage.hide();/*  w ww  .  j  ava2  s.  c o  m*/
        e.consume();
    });
    Pane root = pair.getFirst();
    C controller = pair.getSecond();
    Scene s = new Scene(root);//, AbstractConfigDialog.PREF_WIDTH, AbstractConfigDialog.PREF_HEIGHT
    controller.setParent(root);
    controller.setScene(s);
    controller.setStage(stage);
    stage.setScene(s);
    //stage.setResizable(false);
    stage.setTitle(dialogTitle);
    return controller;
}

From source file:com.jf.javafx.Application.java

/**
 * Start the application/*from   w  w  w .  ja v  a2 s .  com*/
 *
 * @param primaryStage
 * @throws java.lang.Exception
 */
@Override
public void start(Stage primaryStage) throws Exception {
    Application.sapp = this;
    this.pStage = primaryStage;

    // set env variables
    _initVars();
    // load properties
    _initConfigurations();

    _initStartupServices();

    // handle on closing window
    primaryStage.setOnHidden((WindowEvent event) -> {
        _commitProperties();
    });
    primaryStage.initStyle(StageStyle.TRANSPARENT);
    primaryStage.setTitle(getResourceBundle().getString("app.title"));
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(final Stage stage) throws Exception {
    pagination = new Pagination(28, 0);
    pagination.setPageFactory((Integer pageIndex) -> {
        if (pageIndex >= textPages.length) {
            return null;
        } else {//from  ww w. j a  v a2  s  .  com
            return createPage(pageIndex);
        }
    });

    AnchorPane anchor = new AnchorPane();
    AnchorPane.setTopAnchor(pagination, 10.0);
    AnchorPane.setRightAnchor(pagination, 10.0);
    AnchorPane.setBottomAnchor(pagination, 10.0);
    AnchorPane.setLeftAnchor(pagination, 10.0);
    anchor.getChildren().addAll(pagination);
    Scene scene = new Scene(anchor, 400, 250);
    stage.setScene(scene);
    stage.setTitle("PaginationSample");
    stage.show();
}

From source file:ExcelFx.FXMLDocumentController.java

@FXML
private void Open(ActionEvent event) throws NullPointerException, IOException {

    System.out.println("-----------------------------------------------------------");
    System.out.println("Pressed open Button ");
    File universityFile = new File("university.json");
    File collegeFile = new File("college.json");
    System.out.println("University File emty is " + String.valueOf(universityFile.length() == 0));
    System.out.println("College File emty is " + String.valueOf(collegeFile.length() == 0));

    //File codesFile = new File("codes.json");
    if ((universityFile.exists()) && (collegeFile.exists()) /*&& (codesFile.exists())*/) {
        try {/*from   w w w .j a v  a  2s.c  o m*/
            this.universityJson.jsonRead("university.json");
            this.collegeJson.jsonRead("college.json");
            //this.codesJson.jsonRead("codes.json");
            this.jsonXLSXData.setAll(universityJson, collegeJson/*, codesJson*/);
        } catch (IOException | ParseException ex) {
            Alert alert = new Alert(Alert.AlertType.INFORMATION);
            alert.setTitle("");
            alert.setHeaderText(" ? ? ");
            alert.setContentText(ex.toString());
            alert.showAndWait();
            Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
        }

    } else {
        try {
            FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FileOpenFXML.fxml"));
            this.fileOpenParent = (Parent) fxmlLoader.load();
            Stage stage = new Stage();
            stage.initModality(Modality.APPLICATION_MODAL);
            stage.initStyle(StageStyle.DECORATED);
            stage.setTitle(" ");
            stage.setScene(new Scene(this.fileOpenParent));

            stage.showAndWait();
        } catch (Exception e) {
            System.err.println(e);

        }

        this.jsonXLSXData.setAll(universityJson, collegeJson/*, codesJson*/);
    }

    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("InitalData.fxml"));
    Parent root1 = (Parent) fxmlLoader.load();
    Stage stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.initStyle(StageStyle.DECORATED);

    stage.setTitle(" ");
    stage.setScene(new Scene(root1));
    stage.showAndWait();
    setProgressBar(-1.);

    Task task = new Task<Void>() {

        @Override
        protected Void call() throws Exception {

            initaldata = (JsonWrite) root1.getUserData();
            System.out.println("Inital Data empty is " + initaldata.isEmpty());

            initaldata.setPage(String.valueOf(Integer.parseInt(initaldata.getPage()) - 1));

            Parser parser = new Parser();

            list = parser.parseInitalData(initaldata.getPatch(), Integer.parseInt(initaldata.getPage()));
            //System.out.println(list.size());
            Sort sort = new Sort(list, jsonXLSXData, initaldata.getYStart(), initaldata.getYEnd());
            HashMap<String, HashMap<String, ArrayList<String>>> hm = sort
                    .professionsGrouping(initaldata.getYStart(), initaldata.getYEnd());

            sortProf = sort.addWay(hm);

            return null;
        }

    };
    mainProcessing(task);

    System.out.println("button open finished");
    System.out.println("-----------------------------------------------------------");

}

From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java

private void createAccount(ListView<String> to_update) {
    Stage createAccountStage = new Stage();
    createAccountStage.initModality(Modality.APPLICATION_MODAL);

    //Set the stage info
    createAccountStage.setTitle("Add Server Account");

    //Create a layout
    GridPane gp = new GridPane();
    gp.setAlignment(Pos.CENTER);/* w w  w. j  a  v a  2  s. c  om*/
    gp.setVgap(10);
    gp.setHgap(10);
    gp.setPadding(new Insets(25, 25, 25, 25));

    //Ads the important things
    Text welcome = new Text("Create Server Account");
    welcome.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20));
    gp.add(welcome, 0, 0, 2, 1);

    Label username = new Label("Username");
    Label password = new Label("Password");
    Label r_password = new Label("Repeat Password");

    TextField usernamefield = new TextField();
    PasswordField passwordfield = new PasswordField();
    PasswordField r_passwordfield = new PasswordField();

    gp.add(username, 0, 1);
    gp.add(password, 0, 2);
    gp.add(r_password, 0, 3);

    gp.add(usernamefield, 1, 1);
    gp.add(passwordfield, 1, 2);
    gp.add(r_passwordfield, 1, 3);

    Text error = new Text("");
    HBox error_box = new HBox(10);
    error_box.setAlignment(Pos.CENTER);
    error_box.getChildren().add(error);
    gp.add(error_box, 0, 4, 2, 1);

    Button finish = new Button("Finish");
    finish.setDisable(true);
    HBox center_button = new HBox(10);
    center_button.setAlignment(Pos.CENTER);
    center_button.getChildren().add(finish);
    gp.add(center_button, 0, 5, 2, 1);

    ChangeListener name = new ChangeListener<String>() {

        @Override
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            finish.setDisable(true);
            if (usernamefield.getText().equals("")) {
                error.setFill(Color.RED);
                error.setText("Username can not be blank!");
            }
            if (!passwordfield.getText().equals(r_passwordfield.getText())) {
                error.setFill(Color.RED);
                error.setText("Passwords do not match!");
            }
            if (passwordfield.getText().equals("") && r_passwordfield.getText().equals("")) {
                error.setFill(Color.RED);
                error.setText("Passwords can not be blank!");
            }
            if (passwordfield.getText().equals(r_passwordfield.getText()) && !usernamefield.getText().equals("")
                    && !passwordfield.getText().equals("")) {
                error.setFill(Color.GREEN);
                error.setText("No issues.");
                finish.setDisable(false);
            }
        }

    };

    usernamefield.textProperty().addListener(name);
    passwordfield.textProperty().addListener(name);
    r_passwordfield.textProperty().addListener(name);

    finish.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent e) {

            users.remove(usernamefield.getText());
            users.add(usernamefield.getText());
            userpasswords.put(usernamefield.getText(), passwordfield.getText());
            to_update.setItems(FXCollections.observableArrayList(users));

            createAccountStage.close();
        }

    });

    //Creates the scene
    Scene scene = new Scene(gp, 300, 275);
    scene.getStylesheets().add(this.getClass().getResource("login_css.css").toExternalForm());

    createAccountStage.setScene(scene);
    createAccountStage.show();

}

From source file:acmi.l2.clientmod.xdat.Controller.java

private void updateContextMenu(ContextMenu contextMenu, TreeView<Object> elements) {
    contextMenu.getItems().clear();//from   w w w  . ja  v  a2 s  . com

    TreeItem<Object> root = elements.getRoot();
    TreeItem<Object> selected = elements.getSelectionModel().getSelectedItem();

    if (selected == null) {
        if (root != null)
            contextMenu.getItems().add(createAddMenu("Add ..", elements, root));
    } else {
        Object value = selected.getValue();
        if (value instanceof ListHolder) {
            contextMenu.getItems().add(createAddMenu("Add ..", elements, selected));
        } else if (selected.getParent() != null && selected.getParent().getValue() instanceof ListHolder) {
            MenuItem add = createAddMenu("Add to parent ..", elements, selected.getParent());

            MenuItem delete = new MenuItem("Delete");
            delete.setOnAction(event -> {
                ListHolder parent = (ListHolder) selected.getParent().getValue();

                int index = parent.list.indexOf(value);
                editor.getHistory().valueRemoved(treeItemToScriptString(selected.getParent()), index);

                parent.list.remove(index);
                selected.getParent().getChildren().remove(selected);

                elements.getSelectionModel().selectPrevious();
                elements.getSelectionModel().selectNext();
            });
            contextMenu.getItems().addAll(add, delete);
        }
        if (value instanceof ComponentFactory) {
            MenuItem view = new MenuItem("View");
            view.setOnAction(event -> {
                if (value instanceof L2Context)
                    ((L2Context) value).setResources(l2resources.getValue());
                Stage stage = new Stage();
                stage.setTitle(value.toString());
                Scene scene = new Scene(((ComponentFactory) value).getComponent());
                scene.getStylesheets().add(getClass().getResource("l2.css").toExternalForm());
                stage.setScene(scene);
                stage.show();
            });
            contextMenu.getItems().add(view);
        }
    }
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox root = new VBox(5);

    Label textLbl = new Label("Text:");
    TextArea text = new TextArea();
    text.setPrefRowCount(10);/*from   w  w w  . j  a v a  2  s.co m*/
    text.setPrefColumnCount(20);
    text.setWrapText(true);

    // Button to print the TextArea node
    Button printTextBtn = new Button("Print Text");
    printTextBtn.setOnAction(e -> print(text));

    // Button to print the entire scene
    Button printSceneBtn = new Button("Print Scene");
    printSceneBtn.setOnAction(e -> print(root));

    HBox buttonBox = new HBox(5, printTextBtn, printSceneBtn);

    root.getChildren().addAll(textLbl, text, buttonBox);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Printing Nodes");
    stage.show();
}