Example usage for javafx.scene.control Label Label

List of usage examples for javafx.scene.control Label Label

Introduction

In this page you can find the example usage for javafx.scene.control Label Label.

Prototype

public Label(String text) 

Source Link

Document

Creates Label with supplied text.

Usage

From source file:mesclasses.view.RapportClasseController.java

private void drawRow(Eleve eleve, int rowIndex) {

    LOG.debug("rapports : drawing row for " + eleve);
    List<EleveData> data = model.filterDataByTrimestre(eleve.getData(), smartSelect.getValue(), null);
    grid.add(NodeUtil.buildEleveLink(eleve, eleve.lastNameProperty(), Constants.CLASSE_RAPPORT_TABS_VIEW), 1,
            rowIndex, HPos.LEFT);/*from  w  w  w .  ja v  a  2  s  .c  o  m*/

    grid.add(NodeUtil.buildEleveLink(eleve, eleve.firstNameProperty(), Constants.CLASSE_RAPPORT_TABS_VIEW), 2,
            rowIndex, HPos.LEFT);
    // ABSENT
    long abs = data.stream().filter(d -> d.isAbsent()).count();
    Label absent = new Label(String.valueOf(abs));
    grid.add(absent, 3, rowIndex, null);
    // RETARD
    long ret = data.stream().filter(d -> d.getRetard() > 0).count();
    Label retard = new Label(String.valueOf(ret));
    grid.add(retard, 4, rowIndex, null);
    // TRAVAIL
    long tr = data.stream().filter(d -> d.isTravailPasFait()).count();
    Label travail = new Label(String.valueOf(tr));
    grid.add(travail, 5, rowIndex, null);
    // DEVOIR
    Label devoir = new Label(
            "" + model.filterDevoirsByTrimestre(eleve.getDevoirs(), smartSelect.getValue(), null).size());
    grid.add(devoir, 6, rowIndex, null);
    // PUNITION
    Label punition = new Label(
            "" + model.filterPunitionsByTrimestre(eleve.getPunitions(), smartSelect.getValue(), null).size());
    grid.add(punition, 7, rowIndex, null);
    // MOT CARNET
    Label mot = new Label(
            "" + model.filterMotsByTrimestre(eleve.getMots(), smartSelect.getValue(), null).size());
    grid.add(mot, 8, rowIndex, null);
    // OUBLI MATERIEL
    long om = data.stream().filter(d -> StringUtils.isNotBlank(d.getOubliMateriel())).count();
    Label oubli = new Label(String.valueOf(om));
    grid.add(oubli, 9, rowIndex, null);
    // EXCLUSION
    long ex = data.stream().filter(d -> d.isExclus()).count();
    Label exclus = new Label(String.valueOf(ex));
    grid.add(exclus, 10, rowIndex, null);
}

From source file:gov.va.isaac.sync.view.SyncView.java

private void initGui() {
    root_ = new BorderPane();
    root_.setPrefWidth(550);//from   w  w w . j a v  a 2 s  .  com

    VBox titleBox = new VBox();

    Label title = new Label("Datastore Synchronization");
    title.getStyleClass().add("titleLabel");
    title.setAlignment(Pos.CENTER);
    title.setMaxWidth(Double.MAX_VALUE);
    title.setPadding(new Insets(10));
    titleBox.getChildren().add(title);
    titleBox.getStyleClass().add("headerBackground");

    url_ = AppContext.getAppConfiguration().getCurrentChangeSetUrl();
    String urlType = AppContext.getAppConfiguration().getChangeSetUrlTypeName();

    String syncUsername = ExtendedAppContext.getCurrentlyLoggedInUserProfile().getSyncUsername();
    if (StringUtils.isBlank(syncUsername)) {
        syncUsername = ExtendedAppContext.getCurrentlyLoggedInUser();
    }

    url_ = syncService_.substituteURL(url_, syncUsername);

    Label info = new CopyableLabel("Sync using " + urlType + ": " + url_);
    info.setTooltip(new Tooltip(url_));

    titleBox.getChildren().add(info);

    titleBox.setPadding(new Insets(5, 5, 5, 5));
    root_.setTop(titleBox);

    VBox centerContent = new VBox();
    centerContent.setFillWidth(true);
    centerContent.setPrefWidth(Double.MAX_VALUE);
    centerContent.setPadding(new Insets(10));
    centerContent.getStyleClass().add("itemBorder");
    centerContent.setSpacing(10.0);

    centerContent.getChildren().add(new Label("Status:"));

    summary_ = new TextArea();
    summary_.setWrapText(true);
    summary_.setEditable(false);
    summary_.setMaxWidth(Double.MAX_VALUE);
    summary_.setMaxHeight(Double.MAX_VALUE);
    summary_.setPrefHeight(150.0);

    centerContent.getChildren().add(summary_);
    VBox.setVgrow(summary_, Priority.ALWAYS);

    pb_ = new ProgressBar(0.0);
    pb_.setPrefHeight(20);
    pb_.setMaxWidth(Double.MAX_VALUE);

    centerContent.getChildren().add(pb_);

    root_.setCenter(centerContent);

    //Bottom buttons
    HBox buttons = new HBox();
    buttons.setMaxWidth(Double.MAX_VALUE);
    buttons.setAlignment(Pos.CENTER);
    buttons.setPadding(new Insets(5));
    buttons.setSpacing(30);

    Button cancel = new Button("Close");
    cancel.setOnAction((action) -> {
        if (running_.get()) {
            addLine("Cancelling...");
            cancel.setDisable(true);
            cancelRequested_ = true;
        } else {
            cancel.getScene().getWindow().hide();
            root_ = null;
        }
    });
    buttons.getChildren().add(cancel);

    Button action = new Button("Synchronize");
    action.disableProperty().bind(running_);
    action.setOnAction((theAction) -> {
        summary_.setText("");
        pb_.setProgress(-1.0);
        running_.set(true);
        Utility.execute(() -> sync());
    });
    buttons.getChildren().add(action);

    cancel.minWidthProperty().bind(action.widthProperty());

    running_.addListener(change -> {
        if (running_.get()) {
            cancel.setText("Cancel");
        } else {
            cancel.setText("Close");
        }
        cancel.setDisable(false);
    });

    root_.setBottom(buttons);
}

From source file:mesclasses.view.TimetableController.java

private VBox createEvent(Cours theCours) {
    VBox event = new VBox();
    CssUtil.addClass(event, "event");
    CssUtil.addClass(event, getCSS(theCours));
    String periodicite = theCours.getWeek().equals(config.getProperty(Constants.CONF_WEEK_DEFAULT)) ? ""
            : theCours.getWeek();/*from w w w .  j  ava2 s .  c  o m*/
    String salle = StringUtils.isNotBlank(theCours.getRoom()) ? "salle " + theCours.getRoom() : "";
    Label periodiciteAndSalle = new Label((periodicite + " " + salle).trim());
    bindWidth(periodiciteAndSalle, event, 1);
    Label classe = new Label(theCours.getClasse().getName());
    CssUtil.addClass(classe, "event-classe");
    bindWidth(classe, event, 1);

    //horaires
    HBox horaires = new HBox();
    CssUtil.addClass(horaires, "horaires");
    Label start = new Label(" " + NodeUtil.getStartTime(theCours));
    CssUtil.addClass(start, "start");
    Label end = new Label(NodeUtil.getEndTime(theCours) + " ");
    CssUtil.addClass(end, "end");
    horaires.getChildren().add(start);
    horaires.getChildren().add(end);
    bindWidth(horaires, event, 1);
    bindWidth(start, horaires, 2);
    bindWidth(end, horaires, 2);

    event.getChildren().add(periodiciteAndSalle);
    bindHeight(periodiciteAndSalle, event, 3);
    event.getChildren().add(classe);
    bindHeight(classe, event, 3);
    event.getChildren().add(horaires);
    bindHeight(horaires, event, 3);
    event.setOnMouseReleased((e) -> {
        handleEditCours(theCours);
    });
    theCours.setEvent(event);
    return event;
}

From source file:calendarioSeries.vistas.NewSerieController.java

@FXML
public void handleOk() {
    String tituloAux = titulo.getText().replaceAll(" ", "+").toLowerCase();
    String toJson = readUrl(BASE + tituloAux + "&type=series" + "&r=json");
    resultados.getChildren().clear();//from  ww w .j av a  2s . c o m
    try {
        JSONObject busqueda = new JSONObject(toJson);
        if (busqueda.getString("Response").equals("True")) {
            JSONArray res = busqueda.getJSONArray("Search");
            resultados.setPrefRows(res.length());
            for (int i = 0; i < res.length(); i++) {
                JSONObject resActual = new JSONObject(res.get(i).toString());
                HBox resultadoActual = new HBox(50);
                resultadoActual.setMaxWidth(Double.MAX_VALUE);
                resultadoActual.setAlignment(Pos.CENTER_LEFT);
                ImageView posterActual = new ImageView();

                try {
                    Image image = new Image(resActual.getString("Poster"));
                    posterActual.setImage(image);
                    posterActual.setFitHeight(240);
                    posterActual.setFitWidth(180);
                    posterActual.setPreserveRatio(false);
                    resultadoActual.getChildren().add(posterActual);
                } catch (IllegalArgumentException e) {
                    //                        System.out.println("Bad url");
                    Image image = new Image(
                            MainApp.class.getResource("resources/no-image.png").toExternalForm());
                    posterActual.setImage(image);
                    posterActual.setFitHeight(240);
                    posterActual.setFitWidth(180);
                    posterActual.setPreserveRatio(false);
                    resultadoActual.getChildren().add(posterActual);
                }

                String details;
                String nomSerie = new String(resActual.getString("Title").getBytes(), "UTF-8");
                String anoSerie = new String(resActual.getString("Year").getBytes(), "UTF-8");
                if (nomSerie.length() > 15) {
                    details = "%-12.12s...\t\t Ao: %-10s";
                } else {
                    details = "%-12s\t\t Ao: %-10s";
                }
                details = String.format(details, nomSerie, anoSerie);
                Label elemento = new Label(details);
                elemento.setMaxWidth(Double.MAX_VALUE);
                elemento.setMaxHeight(Double.MAX_VALUE);
                resultadoActual.getChildren().add(elemento);

                posterActual.setId(resActual.getString("imdbID"));
                posterActual.setOnMouseClicked(new EventHandler<MouseEvent>() {
                    @Override
                    public void handle(MouseEvent event) {
                        ImageView clickedButton = (ImageView) event.getSource();
                        Stage stage = (Stage) clickedButton.getScene().getWindow();
                        Task task = new Task() {
                            @Override
                            protected Object call() throws Exception {
                                mainController.mainApp.scene.setCursor(Cursor.WAIT);
                                Serie toAdd = new Serie(clickedButton.getId());
                                boolean possible = true;
                                for (Serie serie : mainController.getSeries()) {
                                    if (serie.equals(toAdd))
                                        possible = false;
                                }
                                if (possible)
                                    mainController.getSeries().add(toAdd);

                                try {
                                    mainController.populateImagenes();
                                    mainController.showDetallesMes(mainController.getMesActual());
                                } catch (Exception e) {
                                    e.printStackTrace();
                                } finally {
                                    mainController.mainApp.scene.setCursor(Cursor.DEFAULT);

                                    return mainController.getSeries();
                                }
                            }
                        };
                        Thread th = new Thread(task);
                        th.setDaemon(true);
                        th.start();
                        stage.close();
                    }
                });
                resultados.getChildren().add(resultadoActual);
            }
        } else {
            resultados.getChildren().add(new Label("La busqueda no obtuvo resultados"));
        }
    } catch (JSONException e) {
        e.printStackTrace();
    } catch (UnsupportedEncodingException ex) {
        Logger.getLogger(NewSerieController.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:photobooth.views.EmailPane.java

private void addLabel() {
    String text = Global.getPhrase("email_pane_text");
    Label label = new Label(text);
    label.setWrapText(true);//from   w w  w.java  2s  .  co m
    label.setLayoutX(50);
    label.setLayoutY(150);
    label.setMaxWidth(700);
    label.setTextAlignment(TextAlignment.CENTER);
    label.setFont(new Font(40));
    label.setTextFill(Color.web("#000"));
    this.getChildren().add(label);
}

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

private void openAccountManager() {
    //Window Crap
    Stage accountManagerStage = new Stage();
    accountManagerStage.setTitle("Starbound Server Account Manager");

    GridPane gp = new GridPane();
    gp.setAlignment(Pos.CENTER);//from  ww w.  j a v a  2 s .  c o  m
    gp.setVgap(10);
    gp.setHgap(10);
    gp.setPadding(new Insets(25, 25, 25, 25));

    Text title = new Text("Starbound Account Manager");
    title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20));
    gp.add(title, 0, 0, 2, 1);

    ListView<String> user_list = new ListView<String>();
    ObservableList<String> user_list_o = FXCollections.observableArrayList(users);
    user_list.setItems(user_list_o);
    user_list.setPrefHeight(50);

    ListView<String> banned_users_list = new ListView<String>();
    ObservableList<String> banned_users_list_o = FXCollections.observableArrayList(banned_usernames);
    banned_users_list.setItems(banned_users_list_o);
    banned_users_list.setPrefHeight(50);

    ListView<String> banned_ips_list = new ListView<String>();
    ObservableList<String> banned_ips_list_o = FXCollections.observableArrayList(banned_ips);
    banned_ips_list.setItems(banned_ips_list_o);
    banned_ips_list.setPrefHeight(50);

    ListView<String> banned_playernames_list = new ListView<String>();
    ObservableList<String> banned_playernames_list_o = FXCollections.observableArrayList(banned_playernames);
    banned_playernames_list.setItems(banned_playernames_list_o);
    banned_playernames_list.setPrefHeight(50);

    Label user_list_l = new Label("Current Users");
    Label banned_users_list_l = new Label("Banned Users");
    Label banned_ips_list_l = new Label("Banned IP's");
    Label banned_playernames_list_l = new Label("Banned Player Names");

    Button add_user = new Button("Add User");
    Button add_banned_user = new Button("Add Banned User");
    Button add_banned_ip = new Button("Add Banned IP");
    Button add_banned_playername = new Button("Add Banner Playername");

    Button remove_user = new Button("Remove User");
    Button remove_banned_user = new Button("Remove Banned User");
    Button remove_banned_ip = new Button("Remove Banned IP");
    Button remove_banned_playername = new Button("Remove Banner Playername");

    HBox userbox = new HBox();
    userbox.setAlignment(Pos.BOTTOM_LEFT);
    userbox.getChildren().addAll(add_user, remove_user);
    userbox.setSpacing(5);

    HBox b_userbox = new HBox();
    b_userbox.setAlignment(Pos.BOTTOM_LEFT);
    b_userbox.getChildren().addAll(add_banned_user, remove_banned_user);
    b_userbox.setSpacing(5);

    HBox b_ipbox = new HBox();
    b_ipbox.setAlignment(Pos.BOTTOM_LEFT);
    b_ipbox.getChildren().addAll(add_banned_ip, remove_banned_ip);
    b_ipbox.setSpacing(5);

    HBox b_playerbox = new HBox();
    b_playerbox.setAlignment(Pos.BOTTOM_LEFT);
    b_playerbox.getChildren().addAll(add_banned_playername, remove_banned_playername);
    b_playerbox.setSpacing(5);

    Button save = new Button("Save Config");
    save.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            save();
        }

    });

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

        @Override
        public void handle(ActionEvent event) {
            createAccount(user_list);
        }

    });
    add_banned_user.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            createBannedUser(banned_users_list);
        }

    });
    add_banned_ip.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            createBannedIP(banned_ips_list);
        }

    });
    add_banned_playername.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            createBannedPlayername(banned_playernames_list);
        }

    });

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

        @Override
        public void handle(ActionEvent event) {
            users.remove(user_list.getSelectionModel().getSelectedItem());
            user_list.setItems(FXCollections.observableArrayList(users));
        }

    });
    remove_banned_user.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            banned_usernames.remove(banned_users_list.getSelectionModel().getSelectedItem());
            banned_users_list.setItems(FXCollections.observableArrayList(banned_usernames));
        }

    });
    remove_banned_ip.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            banned_ips.remove(banned_ips_list.getSelectionModel().getSelectedItem());
            banned_ips_list.setItems(FXCollections.observableArrayList(banned_ips));
        }

    });
    remove_banned_playername.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            banned_playernames.remove(banned_playernames_list.getSelectionModel().getSelectedItem());
            banned_playernames_list.setItems(FXCollections.observableArrayList(banned_playernames));
        }

    });

    gp.add(user_list_l, 0, 1);
    gp.add(user_list, 0, 2);
    gp.add(userbox, 0, 3);
    gp.add(banned_users_list_l, 0, 4);
    gp.add(banned_users_list, 0, 5);
    gp.add(b_userbox, 0, 6);
    gp.add(banned_ips_list_l, 0, 7);
    gp.add(banned_ips_list, 0, 8);
    gp.add(b_ipbox, 0, 9);
    gp.add(banned_playernames_list_l, 0, 10);
    gp.add(banned_playernames_list, 0, 11);
    gp.add(b_playerbox, 0, 12);
    gp.add(save, 0, 13);

    Scene sc = new Scene(gp, 800 / 2, 600);
    accountManagerStage.setScene(sc);
    accountManagerStage.show();

}

From source file:Main.java

private void buildGUI() {
    rootPane.setPadding(new Insets(10));
    rootPane.setPrefHeight(30);//from  ww  w.ja v a2  s  .com
    rootPane.setPrefWidth(100);
    rootPane.setVgap(10);
    rootPane.setHgap(20);

    Label playersLabel = new Label("Players");
    Label teamLabel = new Label("Team");

    rootPane.add(playersLabel, 0, 0);
    rootPane.add(leftListView, 0, 1);
    rootPane.add(teamLabel, 1, 0);
    rootPane.add(rightListView, 1, 1);
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    BorderPane root = new BorderPane();
    Scene scene = new Scene(root, 500, 250, Color.WHITE);

    GridPane gridpane = new GridPane();
    gridpane.setPadding(new Insets(5));
    gridpane.setHgap(10);//from w w w .ja v  a2 s.  c  o m
    gridpane.setVgap(10);
    root.setCenter(gridpane);

    ObservableList<Person> leaders = getPeople();
    final ObservableList<Person> teamMembers = FXCollections.observableArrayList();

    ListView<Person> leaderListView = createLeaderListView(leaders);
    TableView<Person> employeeTableView = createEmployeeTableView(teamMembers);

    Label bossesLbl = new Label("Boss");
    GridPane.setHalignment(bossesLbl, HPos.CENTER);
    gridpane.add(bossesLbl, 0, 0);
    gridpane.add(leaderListView, 0, 1);

    Label emplLbl = new Label("Employees");
    GridPane.setHalignment(emplLbl, HPos.CENTER);
    gridpane.add(emplLbl, 2, 0);
    gridpane.add(employeeTableView, 2, 1);

    leaderListView.getSelectionModel().selectedItemProperty()
            .addListener((ObservableValue<? extends Person> observable, Person oldValue, Person newValue) -> {
                if (observable != null && observable.getValue() != null) {
                    teamMembers.clear();
                    teamMembers.addAll(observable.getValue().employeesProperty());
                }
            });
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

private void createClipList(GridPane grid) {
    final VBox vbox = new VBox(30);
    vbox.setAlignment(Pos.TOP_CENTER);// ww w.ja  v  a  2  s  . com

    final Label clipLabel = new Label("Code Monkey To-Do List:");
    clipLabel.setId("clipLabel");

    final Button getUpButton = new Button("Get Up, Get Coffee");
    getUpButton.setPrefWidth(300);
    getUpButton.setOnAction(createPlayHandler(coffeeClip));

    final Button goToJobButton = new Button("Go to Job");
    goToJobButton.setPrefWidth(300);
    goToJobButton.setOnAction(createPlayHandler(jobClip));

    final Button meetingButton = new Button("Have Boring Meeting");
    meetingButton.setPrefWidth(300);
    meetingButton.setOnAction(createPlayHandler(meetingClip));

    final Hyperlink link = new Hyperlink("About Code Monkey...");
    link.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            WebView wv = new WebView();
            wv.getEngine().load("http://www.jonathancoulton.com/2006/04/14/" + "thing-a-week-29-code-monkey/");

            Scene scene = new Scene(wv, 720, 480);

            Stage stage = new Stage();
            stage.setTitle("Code Monkey");
            stage.setScene(scene);
            stage.show();
        }
    });

    vbox.getChildren().addAll(clipLabel, getUpButton, goToJobButton, meetingButton, link);

    GridPane.setHalignment(vbox, HPos.CENTER);
    GridPane.setHgrow(vbox, Priority.ALWAYS);
    GridPane.setVgrow(vbox, Priority.ALWAYS);
    grid.add(vbox, 0, 0, GridPane.REMAINING, 1);
}

From source file:uk.co.everywheremusic.viewcontroller.SetupScene.java

private void startSetupWindow(Stage primaryStage) {
    try {/*from w  ww.  j a va2s  .c om*/
        installFolder = new File(".").getCanonicalPath() + Globals.INSTALL_EXT;
    } catch (IOException ex) {
        Logger.getLogger(SetupScene.class.getName()).log(Level.SEVERE, null, ex);
        installFolder = System.getProperty("user.dir") + Globals.INSTALL_EXT;
    }

    primaryStage.setTitle(Globals.APP_NAME);

    grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    column1 = new ColumnConstraints(100, 100, Double.MAX_VALUE);
    column1.setHgrow(Priority.ALWAYS);
    column2 = new ColumnConstraints(100, 100, Double.MAX_VALUE);
    column2.setHgrow(Priority.ALWAYS);
    column3 = new ColumnConstraints(100, 100, Double.MAX_VALUE);
    column3.setHgrow(Priority.ALWAYS);
    column4 = new ColumnConstraints(100, 100, Double.MAX_VALUE);
    column4.setHgrow(Priority.ALWAYS);
    grid.getColumnConstraints().addAll(column1, column2, column3, column4);

    sceneTitle = new Label(Globals.SETUP_FRAME_TITLE);
    sceneTitle.setId(Globals.CSS_TITLE_ID);
    sceneTitle.setPrefWidth(Double.MAX_VALUE);
    sceneTitle.setAlignment(Pos.CENTER);

    ImageView imageView = null;
    try {

        imageView = new ImageView();
        String img = new File(Globals.IC_LOGO).toURI().toURL().toString();
        imgLogo = new Image(img);

        imageView.setImage(imgLogo);

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

    GridPane titlePane = new GridPane();
    ColumnConstraints c1 = new ColumnConstraints(50);
    ColumnConstraints c2 = new ColumnConstraints(400);
    titlePane.getColumnConstraints().addAll(c1, c2);
    titlePane.add(imageView, 0, 0);
    titlePane.add(sceneTitle, 1, 0);
    titlePane.setAlignment(Pos.CENTER);
    grid.add(titlePane, 0, 0, 4, 1);

    lblFolder = new Label(Globals.SETUP_LBL_MUSIC_FOLDER);
    grid.add(lblFolder, 0, 2, 3, 1);

    txtFolder = new TextField();
    txtFolder.setText("/home/kyle/Music/Test music");
    grid.add(txtFolder, 0, 3, 3, 1);

    btnFolder = new Button(Globals.SETUP_BTN_MUSIC_FOLDER);
    btnFolder.setPrefWidth(Double.MAX_VALUE);
    grid.add(btnFolder, 3, 3);

    final DirectoryChooser dirChooser = new DirectoryChooser();

    btnFolder.setOnAction((ActionEvent event) -> {
        File dir = dirChooser.showDialog(primaryStage);
        if (dir != null) {
            txtFolder.setText(dir.getAbsolutePath());
        }
    });

    lblPassword = new Label("Choose a password:");
    grid.add(lblPassword, 0, 4, 2, 1);

    lblConfirmPassword = new Label("Confirm your password:");
    grid.add(lblConfirmPassword, 2, 4, 2, 1);

    txtPassword = new PasswordField();
    grid.add(txtPassword, 0, 5, 2, 1);

    txtConfirmPassword = new PasswordField();
    grid.add(txtConfirmPassword, 2, 5, 1, 1);

    textArea = new TextArea();
    textArea.setPrefHeight(Double.MAX_VALUE);
    textArea.setDisable(true);
    textArea.setWrapText(true);
    grid.add(textArea, 0, 7, 4, 2);

    StackPane progressPane = new StackPane();
    lblProgress = new Label(Globals.SETUP_LBL_PERCENT);
    lblProgress.setId(Globals.CSS_PROGBAR_LBL_ID);
    lblProgress.setVisible(false);
    progressBar = new ProgressBar(0);
    progressBar.setPrefWidth(Double.MAX_VALUE);
    progressBar.setVisible(false);
    progressPane.getChildren().addAll(progressBar, lblProgress);
    progressPane.setAlignment(Pos.CENTER_RIGHT);
    grid.add(progressPane, 0, 11, 3, 1);

    StackPane buttonPane = new StackPane();
    btnInstall = new Button(Globals.SETUP_BTN_INSTALL);
    btnInstall.setPrefWidth(Double.MAX_VALUE);
    btnDone = new Button(Globals.SETUP_BTN_DONE);
    btnDone.setPrefWidth(Double.MAX_VALUE);
    btnDone.setVisible(false);
    buttonPane.getChildren().addAll(btnInstall, btnDone);
    grid.add(buttonPane, 3, 11);

    btnInstall.setOnAction((ActionEvent event) -> {

        boolean valid = validateForm();
        if (valid) {

            lblFolder.setDisable(true);
            txtFolder.setDisable(true);
            btnFolder.setDisable(true);
            lblPassword.setDisable(true);
            txtPassword.setDisable(true);
            lblConfirmPassword.setDisable(true);
            txtConfirmPassword.setDisable(true);

            textArea.setDisable(false);
            lblProgress.setVisible(true);
            progressBar.setVisible(true);
            btnInstall.setDisable(true);

            musicFolder = txtFolder.getText();
            password = txtPassword.getText();

            setupWorker = createSetupWorker();
            progressBar.progressProperty().unbind();
            progressBar.progressProperty().bind(setupWorker.progressProperty());

            setupWorker.messageProperty().addListener(
                    (ObservableValue<? extends String> observable, String oldValue, String newValue) -> {
                        String[] values = newValue.split("\\|");
                        lblProgress.setText(values[0] + "%");
                        textArea.appendText(values[1] + "\n");

                        if (values[1].equals(Globals.SETUP_MSG_DONE)) {
                            btnInstall.setVisible(false);
                            btnDone.setVisible(true);
                        }

                    });

            new Thread(setupWorker).start();

        }
    });

    btnDone.setOnAction((ActionEvent event) -> {
        primaryStage.hide();
        new ServerScene(installFolder, musicFolder).showWindow(new Stage());
    });

    try {
        String imgUrl = new File(Globals.IC_LOGO).toURI().toURL().toString();
        javafx.scene.image.Image i = new javafx.scene.image.Image(imgUrl);
        primaryStage.getIcons().add(i);
    } catch (MalformedURLException ex) {
        Logger.getLogger(ServerScene.class.getName()).log(Level.SEVERE, null, ex);
    }

    scene = new Scene(grid, 600, 400);
    primaryStage.setScene(scene);

    scene.getStylesheets().add(SetupScene.class.getResource(Globals.CSS_FILE).toExternalForm());
    //  grid.setGridLinesVisible(true);
    primaryStage.show();
}