Example usage for javafx.scene.control Label setId

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

Introduction

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

Prototype

public final void setId(String value) 

Source Link

Usage

From source file:org.jacp.demo.components.ContactAddDialog.java

private void createAddContactDialog() {
    final VBox box = new VBox();
    box.getStyleClass().add("jacp-option-pane");
    box.setMaxSize(300, Region.USE_PREF_SIZE);
    // the title// w w  w. jav  a  2s .  c  om
    final Label title = new Label("Add new category");
    title.setId(GlobalConstants.CSSConstants.ID_JACP_CUSTOM_TITLE);
    VBox.setMargin(title, new Insets(2, 2, 10, 2));

    final HBox hboxInput = new HBox();
    final Label nameLabel = new Label("category name:");
    HBox.setMargin(nameLabel, new Insets(2));
    final TextField nameInput = new TextField();
    HBox.setMargin(nameInput, new Insets(0, 0, 0, 5));
    HBox.setHgrow(nameInput, Priority.ALWAYS);
    hboxInput.getChildren().addAll(nameLabel, nameInput);

    final HBox hboxButtons = new HBox();
    hboxButtons.setAlignment(Pos.CENTER_RIGHT);
    final Button ok = new Button("OK");
    HBox.setMargin(ok, new Insets(6, 5, 4, 2));
    final Button cancel = new Button("Cancel");
    HBox.setMargin(cancel, new Insets(6, 2, 4, 5));
    cancel.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(final ActionEvent arg0) {
            JACPModalDialog.getInstance().hideModalDialog();
        }
    });

    ok.setDefaultButton(true);
    ok.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(final ActionEvent actionEvent) {
            final String catName = nameInput.getText();
            if (catName != null && StringUtils.hasText(catName)) {
                // contacts
                final Contact contact = new Contact();
                contact.setFirstName(catName);
                parent.getContext().send(contact);
                JACPModalDialog.getInstance().hideModalDialog();
            }
        }
    });

    hboxButtons.getChildren().addAll(ok, cancel);
    box.getChildren().addAll(title, hboxInput, hboxButtons);
    JACPModalDialog.getInstance().showModalDialog(box);
}

From source file:Main.java

private void createClipList(GridPane grid) {
    final VBox vbox = new VBox(30);
    vbox.setAlignment(Pos.TOP_CENTER);/*  ww w  .j  a  v a2s.c o  m*/

    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:com.gmail.frogocomics.schematic.gui.Main.java

@Override
public void start(Stage primaryStage) throws Exception {
    this.primaryStage = primaryStage;
    this.root = new GridPane();
    this.primaryScene = new Scene(this.root, 1000, 600, Color.AZURE);

    Label title = new Label("Schematic Utilities");
    title.setId("schematic-utilities");
    title.setPrefWidth(this.primaryScene.getWidth() + 500);
    this.root.add(title, 0, 0);

    filesSelected.setId("files-selected");
    this.root.add(filesSelected, 0, 1);

    Region spacer1 = new Region();
    spacer1.setPrefWidth(30);/*from w w w .j  av  a  2s  .  c om*/
    spacer1.setPrefHeight(30);

    Region spacer2 = new Region();
    spacer2.setPrefWidth(30);
    spacer2.setPrefHeight(30);

    Region spacer3 = new Region();
    spacer3.setPrefWidth(30);
    spacer3.setPrefHeight(250);

    Region spacer4 = new Region();
    spacer4.setPrefWidth(1000);
    spacer4.setPrefHeight(10);

    Region spacer5 = new Region();
    spacer5.setPrefWidth(30);
    spacer5.setPrefHeight(30);

    Region spacer6 = new Region();
    spacer6.setPrefWidth(1000);
    spacer6.setPrefHeight(10);

    Region spacer7 = new Region();
    spacer7.setPrefWidth(1000);
    spacer7.setPrefHeight(100);

    Region spacer8 = new Region();
    spacer8.setPrefWidth(30);
    spacer8.setPrefHeight(30);

    this.root.add(spacer4, 0, 3);

    listView.setId("schematic-list");
    listView.setEditable(false);
    listView.setPrefWidth(500);
    listView.setPrefHeight(250);
    this.root.add(new HBox(spacer3, listView), 0, 4);

    uploadFiles.setPadding(new Insets(5, 5, 5, 5));
    uploadFiles.setPrefWidth(120);
    uploadFiles.setPrefHeight(30);
    uploadFiles.setOnAction((event) -> {
        FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle("Select schematic(s)");
        fileChooser.getExtensionFilters().addAll(
                new FileChooser.ExtensionFilter("MCEdit Schematic File", "*.schematic"),
                new FileChooser.ExtensionFilter("Biome World Object Version 2", "*.bo2"));
        List<File> selectedFiles = fileChooser.showOpenMultipleDialog(this.primaryStage);
        if (selectedFiles != null) {
            if (selectedFiles.size() == 1) {
                filesSelected.setText("There is currently 1 file selected");
            } else {
                filesSelected.setText(
                        "There are currently " + String.valueOf(selectedFiles.size()) + " files selected");
            }
            ObservableList<SchematicLocation> selectedSchematicFiles = FXCollections.observableArrayList();
            selectedSchematicFiles.addAll(selectedFiles.stream().map(f -> new SchematicLocation(f, f.getName()))
                    .collect(Collectors.toList()));
            listView.setItems(selectedSchematicFiles);
            this.schematics = selectedSchematicFiles;
        }

    });
    this.root.add(new HBox(spacer1, uploadFiles, spacer2,
            new Label("Only .schematic files are allowed at this point!")), 0, 2);

    editing.setPadding(new Insets(5, 5, 5, 5));
    editing.setPrefWidth(240);
    editing.setPrefHeight(30);
    editing.setDisable(true);
    editing.setOnAction(event -> this.primaryStage.setScene(Editing.getScene()));
    this.root.add(new HBox(spacer8, editing), 0, 8);

    loadSchematics.setPadding(new Insets(5, 5, 5, 5));
    loadSchematics.setPrefWidth(120);
    loadSchematics.setPrefHeight(30);
    loadSchematics.setOnAction(event -> {
        if (this.schematics != null) {
            ((Runnable) () -> {
                for (SchematicLocation location : this.schematics) {
                    if (FilenameUtils.isExtension(location.getLocation().getName(), "schematic")) {
                        try {
                            Schematics.schematics.add(McEditSchematicObject.load(location.getLocation()));
                        } catch (ParseException | ClassicNotSupportedException | IOException e) {
                            e.printStackTrace();
                        }
                    } else if (FilenameUtils.isExtension(location.getLocation().getName(), "bo2")) {
                        try {
                            Schematics.schematics.add(BiomeWorldV2Object.load(location.getLocation()));
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                }
            }).run();
            loadSchematics.setDisable(true);
            uploadFiles.setDisable(true);
            listView.setDisable(true);
            editing.setDisable(false);
        }
    });
    this.root.add(spacer6, 0, 5);
    this.root.add(new HBox(spacer5, loadSchematics), 0, 6);
    this.root.add(spacer7, 0, 7);

    this.primaryScene.getStylesheets()
            .add("https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800");
    this.primaryScene.getStylesheets().add(new File("style.css").toURI().toURL().toExternalForm());
    this.primaryStage.setScene(this.primaryScene);
    this.primaryStage.setResizable(false);
    this.primaryStage.setTitle("Schematic Utilities - by frogocomics");
    this.primaryStage.show();
}

From source file:calendarioSeries.vistas.MainViewController.java

public void showDetallesMes(Mes mes) {
    // System.out.println(mes.getNumAno() + " - " + mes.getNumMes() + "(" + mes.getDiasMes() + ")");
    Platform.runLater(new Runnable() {
        @Override/*from ww w. j  a  v a2 s. co m*/
        public void run() {
            for (Label diasMe : diasMes) {
                diasMe.setStyle("");
                diasMe.setId("");
            }
            labelNombreMes.setText(mes.getNombreMes().toUpperCase());
            labelNumMes.setText(Integer.toString(mes.getNumMes() + 1));
            labelNumAno.setText(Integer.toString(mes.getNumAno()));

            Calendar cal = Calendar.getInstance();
            cal.set(Calendar.MONTH, mes.getNumMes());
            cal.set(Calendar.YEAR, mes.getNumAno());
            cal.set(Calendar.DAY_OF_MONTH, 1);

            int firstDay = cal.getTime().getDay();
            if (firstDay != 0) {
                firstDay -= 1;
            } else {
                firstDay = 6;
            }
            int count = 1;

            for (int i = 0; i < mes.getDiasMes(); i++) {
                String caps = "";
                for (Serie serie : series) {
                    Map<Integer, String> capitulosMes = serie.getCapitulosMes(mes.getNumAno(),
                            mes.getNumMes() + 1);
                    if (capitulosMes.get(count) != null) {
                        for (Map.Entry<Integer, String> entry : capitulosMes.entrySet()) {
                            if (entry.getKey() == count) {
                                if (entry.getValue().length() >= 30) {
                                    caps += serie.getTitulo() + ": +2 caps";
                                } else {
                                    caps += serie.getTitulo() + ": " + entry.getValue();
                                    caps += "\n";
                                }
                            }
                        }
                    }
                }
                diasMes.get(firstDay + i).setText(Integer.toString(count) + "\n\n" + caps);
                if (mes.getNumAno() == esteAno) {
                    if (mes.getNumMes() == esteMes) {
                        if (count == hoy) {
                            diasMes.get(firstDay + i).setId("hoy");
                        } else if (count < hoy) {
                            diasMes.get(firstDay + i).setStyle("-fx-text-fill: grey;");
                        }
                    } else if (mes.getNumMes() < esteMes) {
                        diasMes.get(firstDay + i).setStyle("-fx-text-fill: grey;");
                    }
                } else if (mes.getNumAno() < esteAno) {
                    diasMes.get(firstDay + i).setStyle("-fx-text-fill: grey;");
                }
                count++;
            }
        }
    });
}