Example usage for javafx.scene.control TextField clear

List of usage examples for javafx.scene.control TextField clear

Introduction

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

Prototype

public void clear() 

Source Link

Document

Clears the text.

Usage

From source file:Main.java

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

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

    notification.clear();

    GridPane grid = new GridPane();
    grid.setVgap(4);/*  w w  w  . j a v  a2 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) {
    stage.setTitle("ComboBoxSample");
    Scene scene = new Scene(new Group(), 450, 250);

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

    notification.clear();

    GridPane grid = new GridPane();
    grid.setVgap(4);// ww w  . ja v  a 2s  .  co m
    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:mesclasses.view.JourneeController.java

/**
 * dessine la grid sanctions//from w ww  .  ja va 2  s  .  c o m
 * @param eleve
 * @param rowIndex 
 */
private void drawSanctions(Eleve eleve, int rowIndex) {
    EleveData eleveData = seanceSelect.getValue().getDonnees().get(eleve);

    drawEleveName(sanctionsGrid, eleve, rowIndex);
    if (!eleve.isInClasse(currentDate.getValue())) {
        return;
    }
    HBox punitionsBox = new HBox();
    punitionsBox.setAlignment(Pos.CENTER_LEFT);
    TextFlow nbPunitions = new TextFlow();
    Label nbPunitionLabel = new Label(
            "" + eleve.getPunitions().stream().filter(p -> p.getSeance() == seanceSelect.getValue()).count());
    nbPunitionLabel.setPrefHeight(20);
    nbPunitions.getChildren().add(new Label(" ("));
    nbPunitions.getChildren().add(nbPunitionLabel);
    nbPunitions.getChildren().add(new Label(")"));

    nbPunitions.visibleProperty().bind(nbPunitionLabel.textProperty().isNotEqualTo("0"));
    nbPunitions.managedProperty().bind(nbPunitionLabel.textProperty().isNotEqualTo("0"));

    Button punitionBtn = Btns.punitionBtn();
    punitionBtn.setOnAction((event) -> {
        if (openPunitionDialog(eleve)) {
            int nbPunition = Integer.parseInt(nbPunitionLabel.getText());
            nbPunitionLabel.setText("" + (nbPunition + 1));
        }
    });
    punitionsBox.getChildren().add(punitionBtn);
    punitionsBox.getChildren().add(nbPunitions);

    sanctionsGrid.add(punitionsBox, 3, rowIndex, HPos.LEFT);

    CheckBox motCarnet = new CheckBox();
    Label cumulMot = new Label();
    motCarnet.setSelected(model.getMotForSeance(eleve, seanceSelect.getValue()) != null);
    motCarnet.selectedProperty().addListener((ob, o, checked) -> {
        Mot mot = model.getMotForSeance(eleve, seanceSelect.getValue());
        if (checked && mot == null) {
            model.createMot(eleve, seanceSelect.getValue());
        } else if (mot != null) {
            model.delete(mot);
        }
        writeAndMarkInRed(cumulMot, stats.getMotsUntil(eleve, currentDate.getValue()).size(), 3);
    });
    sanctionsGrid.add(motCarnet, 4, rowIndex, null);
    writeAndMarkInRed(cumulMot, stats.getMotsUntil(eleve, currentDate.getValue()).size(), 3);
    sanctionsGrid.add(cumulMot, 5, rowIndex, null);

    CheckBox exclus = new CheckBox();
    TextField motif = new TextField();
    Bindings.bindBidirectional(exclus.selectedProperty(), eleveData.exclusProperty());
    sanctionsGrid.add(exclus, 6, rowIndex, null);
    exclus.selectedProperty().addListener((o, oldV, newV) -> {
        if (!newV && StringUtils.isNotBlank(motif.getText())
                && ModalUtil.confirm("Effacer le motif ?", "Effacer le motif ?")) {
            motif.clear();
        }
    });

    Bindings.bindBidirectional(motif.textProperty(), eleveData.MotifProperty());
    motif.textProperty().addListener((o, oldV, newV) -> {
        if (StringUtils.isNotBlank(newV)) {
            exclus.setSelected(true);
        }
    });
    GridPane.setMargin(motif, new Insets(0, 10, 0, 0));
    sanctionsGrid.add(motif, 7, rowIndex, HPos.LEFT);

}