Example usage for javafx.scene.control Label setText

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

Introduction

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

Prototype

public final void setText(String value) 

Source Link

Usage

From source file:com.imesha.imageprocessor.controllers.MainController.java

/**
 * Utility method to show a given message in the message are of the UI.
 *
 * @param message      The message to be displayed
 * @param messageLabel The @{@link Label} object in which the message should be displayed
 *///from   w w w. j  a v a  2  s  .  c om
private static void showMessage(final String message, final Label messageLabel) {
    Platform.runLater(new Runnable() {
        public void run() {
            messageLabel.setText(message);
        }
    });
}

From source file:Main.java

private static Node createConfirmationPanel() {
    final Label acceptanceLabel = new Label("Not Available");

    final Button acceptButton = new Button("Accept");
    acceptButton.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(final ActionEvent event) {
            acceptanceLabel.setText("Accepted");
        }/*from w  w w.  j a  v  a2  s.c o m*/
    });

    final Button declineButton = new Button("Decline");
    declineButton.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(final ActionEvent event) {
            acceptanceLabel.setText("Declined");
        }
    });

    final HBox panel = createHBox(6, acceptButton, declineButton, acceptanceLabel);
    panel.setAlignment(Pos.CENTER_LEFT);
    configureBorder(panel);

    return panel;
}

From source file:Main.java

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

    Label notification = new Label();
    notification.setText("Label");

    GridPane grid = new GridPane();
    grid.setVgap(4);//from  ww w. j a v a  2  s  . c om
    grid.setHgap(10);
    grid.setPadding(new Insets(5, 5, 5, 5));
    grid.add(new Label("To: "), 0, 0);
    grid.add(notification, 1, 0);

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

}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 150);
    stage.setScene(scene);//from   w w w .j a v  a  2  s .  c o m
    stage.setTitle("Progress Controls");

    for (int i = 0; i < values.length; i++) {
        final Label label = labels[i] = new Label();
        label.setText("progress:" + values[i]);

        final ProgressBar pb = pbs[i] = new ProgressBar();
        pb.setProgress(values[i]);

        final ProgressIndicator pin = pins[i] = new ProgressIndicator();
        pin.setProgress(values[i]);
        final HBox hb = hbs[i] = new HBox();
        hb.setSpacing(5);
        hb.setAlignment(Pos.CENTER);
        hb.getChildren().addAll(label, pb, pin);
    }

    final VBox vb = new VBox();
    vb.setSpacing(5);
    vb.getChildren().addAll(hbs);
    scene.setRoot(vb);
    stage.show();
}

From source file:dataflow.screens.ControlledScreen.java

public void setWelcomeMessage(Label user, Label accessText) {
    user.setText("Welcome, " + WordUtils.capitalizeFully(Account.getFirstName()) + " "
            + WordUtils.capitalizeFully(Account.getLastName()) + "!");
    String access = "";
    switch (Account.getAccessLevel()) {
    case Account.NORMAL:
        access = "Normal Account";
        break;//w  w  w  .j  a v a2s .c  o  m
    case Account.SUPERVISOR:
        access = "Supervisor Account";
        break;
    case Account.ADMIN:
        access = "Admin Account";
        break;
    }
    accessText.setText(access);
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Label nameLbl = new Label("Enter your name:");
    TextField nameFld = new TextField();

    Label msg = new Label();

    Button sayHelloBtn = new Button("Say Hello");

    sayHelloBtn.setOnAction(e -> {/*from  w  w  w.j a  v a 2 s  .  c om*/
        String name = nameFld.getText();
        if (name.trim().length() > 0) {
            msg.setText("Hello " + name);
        } else {
            msg.setText("Hello there");
        }
    });

    VBox root = new VBox();

    root.setSpacing(5);

    root.getChildren().addAll(nameLbl, nameFld, msg, sayHelloBtn);

    Scene scene = new Scene(root, 350, 150);
    stage.setScene(scene);
    stage.setTitle("hi");
    stage.show();
}

From source file:com.playonlinux.ui.impl.javafx.mainwindow.center.ViewApps.java

private void initFailure() {
    failurePanel = new VBox();
    failurePanel.getStyleClass().add("rightPane");

    failurePanel.setSpacing(10);/*from  w w w  . j  a  v  a2 s.  co m*/
    failurePanel.setAlignment(Pos.CENTER);

    Label failureNotificationLbl = new Label();
    failureNotificationLbl.setText(translate(
            "Connecting to ${application.name} failed.\n" + "Please check your connection and try again."));
    failureNotificationLbl.setTextAlignment(TextAlignment.CENTER);

    ImageView retryImage = new ImageView(new Image(getClass().getResourceAsStream("refresh.png")));
    retryImage.setFitWidth(16);
    retryImage.setFitHeight(16);
    retryButton = new Button(translate("Retry"), retryImage);

    failurePanel.getChildren().addAll(failureNotificationLbl, retryButton);
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Label nameLbl = new Label("Enter your name:");
    TextField nameFld = new TextField();

    Label msg = new Label();
    msg.setStyle("-fx-text-fill: blue;");

    Button sayHelloBtn = new Button("Say Hello");
    Button exitBtn = new Button("Exit");

    sayHelloBtn.setOnAction(e -> {// w  w  w .  j  a v  a 2 s . com
        String name = nameFld.getText();
        if (name.trim().length() > 0) {
            msg.setText("Hello " + name);
        } else {
            msg.setText("Hello there");
        }
    });

    exitBtn.setOnAction(e -> Platform.exit());

    VBox root = new VBox();

    root.setSpacing(5);
    root.getChildren().addAll(nameLbl, nameFld, msg, sayHelloBtn, exitBtn);

    Scene scene = new Scene(root, 350, 150);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {

    Button btn = new Button();
    final Label lbl = new Label();

    primaryStage.setTitle("Hello World!");

    lbl.setLayoutX(70);//from   ww w.  j  av  a  2  s .  c om
    lbl.setLayoutY(150);

    btn.setLayoutX(100);
    btn.setLayoutY(100);
    btn.setText("Hello, World!");

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

        @Override
        public void handle(ActionEvent event) {
            lbl.setText("Hello, World.");
        }
    });

    Group root = new Group();

    root.getChildren().add(btn);
    root.getChildren().add(lbl);
    primaryStage.setScene(new Scene(root, 300, 250));
    primaryStage.show();
}

From source file:com.loop81.fxcomparer.FXComparerController.java

private void handleFile(ComparableArchive archive, TextField filePath, Label infoLabel) {
    if (archive != null) {
        filePath.setText(archive.getPath());
        infoLabel.setText(MessageBundle.getString("file.info",
                FileUtils.byteCountToDisplaySize(archive.getSize()), archive.getSize()));

        if (archive1 != null && archive2 != null) {
            initCompare();/*  w ww  .ja v  a2  s . c o  m*/
        }
    }
}