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:gov.va.isaac.gui.listview.operations.ParentReplace.java

@Override
public void init(ObservableList<SimpleDisplayConcept> conceptList) {
    super.init(conceptList);
    root_.add(new Label("Replace: "), 0, 0);

    replaceOptions_ = new ComboBox<>();
    replaceOptions_.setMaxWidth(Double.MAX_VALUE);
    replaceOptions_.setPromptText("-Populate the Concepts List-");
    root_.add(ErrorMarkerUtils.setupErrorMarker(replaceOptions_, replaceOptionsInvalidString_), 1, 0);
    ComboBoxSetupTool.setupComboBox(replaceOptions_);

    root_.add(new Label("With Parent: "), 0, 1);
    withConcept_ = new ConceptNode(null, true);
    root_.add(withConcept_.getNode(), 1, 1);

    GridPane.setHgrow(withConcept_.getNode(), Priority.ALWAYS);
    FxUtils.preventColCollapse(root_, 0);
    initActionListeners();//  w ww .j  av  a  2 s.c o  m
    replaceOptions_.getItems().addAll(conceptList);
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("ComboBoxSample");
    Scene scene = new Scene(new Group(), 450, 250);

    ComboBox emailComboBox = new ComboBox();
    emailComboBox.getItems().addAll("A", "B", "C", "D", "E");
    emailComboBox.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {
        @Override/*from  w  w w . j  a v a 2s  .co  m*/
        public ListCell<String> call(ListView<String> param) {
            final ListCell<String> cell = new ListCell<String>() {
                {
                    super.setPrefWidth(100);
                }

                @Override
                public void updateItem(String item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null) {
                        setText(item);
                        if (item.contains("A")) {
                            setTextFill(Color.RED);
                        } else if (item.contains("B")) {
                            setTextFill(Color.GREEN);
                        } else {
                            setTextFill(Color.BLACK);
                        }
                    } else {
                        setText(null);
                    }
                }
            };
            return cell;
        }

    });

    GridPane grid = new GridPane();
    grid.setVgap(4);
    grid.setHgap(10);
    grid.setPadding(new Insets(5, 5, 5, 5));
    grid.add(new Label("To: "), 0, 0);
    grid.add(emailComboBox, 1, 0);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(grid);
    stage.setScene(scene);
    stage.show();

}

From source file:Main.java

public VBox createPage(int pageIndex) {
    VBox box = new VBox(5);
    int page = pageIndex * itemsPerPage();
    for (int i = page; i < page + itemsPerPage(); i++) {
        Label font = new Label(fonts[i]);
        box.getChildren().add(font);/*ww w  .j  a  v  a2s.  co  m*/
    }
    return box;
}

From source file:org.mskcc.shenkers.control.track.bigwig.BigWigView.java

@Override
public Task<Pane> getContent(BigWigContext context) {
    return context.spanProperty().getValue().map(i -> {

        String chr = i.getChr();//from www .j  ava2  s.  com
        int start = i.getStart();
        int end = i.getEnd();

        Task<Pane> task = new PaneTask(context, chr, start, end);

        logger.info("returning task");
        return task;
    }).orElse(new Task<Pane>() {

        @Override
        protected Pane call() throws Exception {
            return new BorderPane(new Label("coordinates not set"));
        }
    }
    //                new BorderPane(new Label("bamview1: span not set"))
    //                new Pane()
    );
}

From source file:org.blockedit.utils.ExceptionDialog.java

/**
 * Create a exception alert that is displayed to the user.
 *
 * @param message The message to show the user
 * @param title The title of the window/*from  w  ww. j  a  va  2  s  .  c  o m*/
 * @param header The message header
 * @param exception The exception that triggered this window to be displayed to the user
 * @return A created alert
 */
private static Alert createDialog(String message, String title, String header, Exception exception) {
    Alert alert = new Alert(Alert.AlertType.ERROR);
    alert.setTitle(title);
    alert.setHeaderText(header);
    alert.setContentText(message);
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    String exceptionText = ExceptionUtils.getStackTrace(exception);
    exception.printStackTrace();
    Label label = new Label("The exception stacktrace was:");
    TextArea exceptionArea = new TextArea(
            exceptionText + "\n\n==User Information==\njava.version = " + System.getProperty("java.version")
                    + "\nos.name = " + System.getProperty("os.name") + "\nos.arch = "
                    + System.getProperty("os.arch") + "\nos.version = " + System.getProperty("os.version"));
    exceptionArea.setEditable(false);
    exceptionArea.setWrapText(true);
    exceptionArea.setMaxWidth(UserInformation.getWindowWidth() / 2);
    exceptionArea.setMaxHeight(UserInformation.getWindowHeight() / 2);
    GridPane.setVgrow(exceptionArea, Priority.ALWAYS);
    GridPane.setHgrow(exceptionArea, Priority.ALWAYS);
    GridPane expContent = new GridPane();
    expContent.setMaxWidth(UserInformation.getWindowWidth() / 2);
    expContent.add(label, 0, 0);
    expContent.add(exceptionArea, 0, 1);
    alert.getDialogPane().setExpandableContent(expContent);
    return alert;
}

From source file:org.pdfsam.splitbysize.SplitOptionsPane.java

SplitOptionsPane() {
    this.field.setOnEnterValidation(true);
    this.field.setEnableInvalidStyle(true);
    this.field.setPromptText(DefaultI18nContext.getInstance().i18n("Set the size to split at"));
    this.field.setValidator(Validators.newPositiveIntegerString());
    this.field.setErrorMessage(DefaultI18nContext.getInstance().i18n("Size must be a number"));
    this.field.setId("sizeField");
    getStyleClass().addAll(Style.CONTAINER.css());
    getStyleClass().addAll(Style.HCONTAINER.css());
    getChildren().addAll(new Label(DefaultI18nContext.getInstance().i18n("Split at this size:")), this.field);
    Arrays.stream(SizeUnit.values()).map(SizeUnitRadio::new).forEach(r -> {
        r.setToggleGroup(group);/*from  w ww.  j a va 2  s .co m*/
        getChildren().add(r);
    });
    group.getToggles().stream().findFirst().ifPresent(t -> t.setSelected(true));
}

From source file:ui.ChoseFonctionnalite.java

private void initUI() {
    Pane root = new Pane();
    root.setBackground(new Background(new BackgroundImage(new Image("resource/background.jpg"),
            BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER,
            new BackgroundSize(530, 400, true, true, true, true))));

    JFXButton serveur = new JFXButton("SERVEUR");
    serveur.setCursor(Cursor.HAND);
    serveur.setMinSize(171, 57);/*  ww  w  .  jav a2 s.  c o  m*/
    serveur.setLayoutX(179);
    serveur.setLayoutY(90);
    serveur.setFont(new Font(27));
    serveur.setStyle("-fx-background-color: #9E21FF;");
    serveur.setOnAction(event -> {
        startServerMode();
    });

    JFXButton client = new JFXButton("CLIENT");
    client.setCursor(Cursor.HAND);
    client.setMinSize(171, 57);
    client.setLayoutX(179);
    client.setLayoutY(197);
    client.setFont(new Font(27));
    client.setStyle("-fx-background-color: #9E21FF;");
    client.setOnAction(event -> {
        startClientMode(event);
    });

    Label info = new Label("choisir la maniere d'utiliser virtual remote");
    info.setMinSize(529, 43);
    info.setLayoutX(10);
    info.setLayoutY(14);
    info.setFont(new Font("Algerian", 20));
    root.getChildren().add(client);
    root.getChildren().add(serveur);
    root.getChildren().add(info);
    Scene scene = new Scene(root, 530, 400);
    stage.setTitle("Fontionnalit");
    stage.setScene(scene);
    stage.setResizable(false);
    stage.initStyle(StageStyle.DECORATED);
    stage.setOnCloseRequest(event -> {
        System.exit(1);
    });
    stage.show();
}

From source file:gov.va.isaac.gui.listview.operations.ParentRetire.java

@Override
public void init(ObservableList<SimpleDisplayConcept> conceptList) {
    super.init(conceptList);
    root_.add(new Label("Retire as parent"), 0, 0);
    retireAsParent_.setPromptText("-Populate the Concepts List-");
    Node n = ErrorMarkerUtils.setupErrorMarker(retireAsParent_, replaceOptionsInvalidString_);
    root_.add(n, 1, 0);//from  w  ww .  j a va2s .com

    ComboBoxSetupTool.setupComboBox(retireAsParent_);
    // TODO populate retireAsParentCombo

    retireAsParent_.setMaxWidth(Double.MAX_VALUE);
    GridPane.setHgrow(n, Priority.ALWAYS);
    FxUtils.preventColCollapse(root_, 0);

    retireAsParent_.getItems().addListener(new ListChangeListener<SimpleDisplayConcept>() {
        @Override
        public void onChanged(javafx.collections.ListChangeListener.Change<? extends SimpleDisplayConcept> c) {
            if (retireAsParent_.getItems().size() > 0) {
                replaceOptionsInvalidString_.set(null);
                if (retireAsParent_.getSelectionModel().getSelectedItem() == null) {
                    retireAsParent_.getSelectionModel().selectFirst();
                }
            } else {
                replaceOptionsInvalidString_.set("A concept must be selected from this drop down");
                retireAsParent_.getSelectionModel().clearSelection();
                retireAsParent_.setValue(null);
                retireAsParent_.setPromptText("-Populate the Concepts List-");
            }
        }
    });

    allValid_ = new BooleanBinding() {
        {
            super.bind(replaceOptionsInvalidString_);
        }

        @Override
        protected boolean computeValue() {
            return StringUtils.isBlank(replaceOptionsInvalidString_.get());
        }
    };

}

From source file:org.pdfsam.ui.io.PdfDestinationPane.java

public PdfDestinationPane(BrowsableField destination, String ownerModule) {
    super(destination);
    this.ownerModule = defaultString(ownerModule);
    version = new PdfVersionCombo(ownerModule);
    compress = new PdfVersionConstrainedCheckBox(PdfVersion.VERSION_1_5, ownerModule);
    compress.setText(DefaultI18nContext.getInstance().i18n("Compress output file/files"));
    HBox versionPane = new HBox(2,
            new Label(DefaultI18nContext.getInstance().i18n("Output document pdf version:")), version);
    versionPane.setAlignment(Pos.BOTTOM_LEFT);
    versionPane.getStyleClass().addAll(Style.VITEM.css());
    getHChildren().add(compress);//w  w  w .jav a2s  .co  m
    getChildren().addAll(versionPane);
    eventStudio().addAnnotatedListeners(this);
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 260, 80);
    stage.setScene(scene);/*w ww . j a  v a2  s .  c  o m*/
    stage.setTitle("Password Field Sample");

    VBox vb = new VBox();
    vb.setPadding(new Insets(10, 0, 0, 10));
    vb.setSpacing(10);
    HBox hb = new HBox();
    hb.setSpacing(10);
    hb.setAlignment(Pos.CENTER_LEFT);

    Label label = new Label("Password");
    final PasswordField pb = new PasswordField();

    pb.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            if (!pb.getText().equals("abc")) {
                message.setText("Your password is incorrect!");
                message.setTextFill(Color.web("red"));
            } else {
                message.setText("Your password has been confirmed");
                message.setTextFill(Color.web("black"));
            }
            pb.setText("");
        }
    });

    hb.getChildren().addAll(label, pb);
    vb.getChildren().addAll(hb, message);

    scene.setRoot(vb);
    stage.show();
}