Example usage for javafx.scene.control TextField setEditable

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

Introduction

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

Prototype

public final void setEditable(boolean value) 

Source Link

Usage

From source file:de.rkl.tools.tzconv.TimezoneConverter.java

private Node createTemplateNameField() {
    final TextField templateNameField = new TextField();
    templateNameField.setEditable(false);
    final File templateFile = applicationModel.templateFile.getValue();
    templateNameField.setText(templateFile == null ? StringUtils.EMPTY : templateFile.getName());
    applicationModel.templateFile.addListener((observable, oldValue, newValue) -> {
        templateNameField.setText(newValue == null ? StringUtils.EMPTY : newValue.getName());
    });/*  w w w  . ja va  2s .  co  m*/
    return templateNameField;
}

From source file:eu.over9000.skadi.ui.dialogs.PerformUpdateDialog.java

public PerformUpdateDialog(RemoteVersionResult newVersion) {
    this.chosen = new SimpleObjectProperty<>(
            Paths.get(SystemUtils.USER_HOME, newVersion.getVersion() + ".jar").toFile());

    this.setHeaderText("Updating to " + newVersion.getVersion());
    this.setTitle("Skadi Updater");
    this.getDialogPane().getStyleClass().add("alert");
    this.getDialogPane().getStyleClass().add("information");

    final ButtonType restartButtonType = new ButtonType("Start New Version", ButtonBar.ButtonData.OK_DONE);
    this.getDialogPane().getButtonTypes().addAll(restartButtonType, ButtonType.CANCEL);

    Node btn = this.getDialogPane().lookupButton(restartButtonType);
    btn.setDisable(true);// www  . j  av a 2s .  c  o m

    Label lbPath = new Label("Save as");
    TextField tfPath = new TextField();
    tfPath.textProperty()
            .bind(Bindings.createStringBinding(() -> this.chosen.get().getAbsolutePath(), this.chosen));
    tfPath.setPrefColumnCount(40);
    tfPath.setEditable(false);

    Button btChangePath = GlyphsDude.createIconButton(FontAwesomeIcons.FOLDER_OPEN, "Browse...");
    btChangePath.setOnAction(event -> {
        FileChooser fc = new FileChooser();
        fc.setTitle("Save downloaded jar..");
        fc.setInitialFileName(this.chosen.getValue().getName());
        fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("Jar File", ".jar"));
        fc.setInitialDirectory(this.chosen.getValue().getParentFile());
        File selected = fc.showSaveDialog(this.getOwner());
        if (selected != null) {
            this.chosen.set(selected);
        }
    });

    ProgressBar pbDownload = new ProgressBar(0);
    pbDownload.setDisable(true);
    pbDownload.setMaxWidth(Double.MAX_VALUE);
    Label lbDownload = new Label("Download");
    Label lbDownloadValue = new Label();
    Button btDownload = GlyphsDude.createIconButton(FontAwesomeIcons.DOWNLOAD, "Start");
    btDownload.setMaxWidth(Double.MAX_VALUE);
    btDownload.setOnAction(event -> {
        btChangePath.setDisable(true);
        btDownload.setDisable(true);

        this.downloadService = new DownloadService(newVersion.getDownloadURL(), this.chosen.getValue());

        lbDownloadValue.textProperty().bind(this.downloadService.messageProperty());
        pbDownload.progressProperty().bind(this.downloadService.progressProperty());

        this.downloadService.setOnSucceeded(dlEvent -> {
            btn.setDisable(false);
        });
        this.downloadService.setOnFailed(dlFailed -> {
            LOGGER.error("new version download failed", dlFailed.getSource().getException());
            lbDownloadValue.textProperty().unbind();
            lbDownloadValue.setText("Download failed, check log file for details.");
        });

        this.downloadService.start();
    });

    final GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setVgap(10);

    grid.add(lbPath, 0, 0);
    grid.add(tfPath, 1, 0);
    grid.add(btChangePath, 2, 0);
    grid.add(new Separator(), 0, 1, 3, 1);
    grid.add(lbDownload, 0, 2);
    grid.add(pbDownload, 1, 2);
    grid.add(btDownload, 2, 2);
    grid.add(lbDownloadValue, 1, 3);

    this.getDialogPane().setContent(grid);

    this.setResultConverter(btnType -> {
        if (btnType == restartButtonType) {
            return this.chosen.getValue();
        }

        if (btnType == ButtonType.CANCEL) {
            if (this.downloadService.isRunning()) {
                this.downloadService.cancel();
            }
        }

        return null;
    });

}

From source file:account.management.controller.POVoucherController.java

public void addNewRow() {
    TextField sl = new TextField();
    sl.setPromptText("SL");
    sl.setPrefWidth(54);//  w w w  .ja  v  a  2s .c  om
    sl.setEditable(false);

    TextField desc = new TextField();
    desc.setPromptText("Description");
    desc.setPrefWidth(216);

    TextField qty = new TextField();
    qty.setPromptText("Quantity");
    qty.setPrefWidth(62);
    qty.setOnKeyReleased((e) -> {
        calculate();
    });

    TextField rate = new TextField();
    rate.setPromptText("Rate");
    rate.setPrefWidth(72);
    rate.setOnKeyReleased((e) -> {
        calculate();
    });

    TextField total = new TextField();
    total.setPromptText("Total");
    total.setPrefWidth(80);
    total.setEditable(false);

    TextField commision = new TextField();
    commision.setPromptText("Commision %");
    commision.setPrefWidth(90);
    commision.setOnKeyReleased((e) -> {
        calculate();
    });

    TextField total_commision = new TextField();
    total_commision.setPromptText("Total Commision");
    total_commision.setPrefWidth(132);
    total_commision.setEditable(false);

    TextField neat_total = new TextField();
    neat_total.setPromptText("Neat Amount");
    neat_total.setPrefWidth(115);
    neat_total.setEditable(false);

    Button delete = new Button("Delete");

    HBox row = new HBox();
    row.setSpacing(10);
    row.getChildren().addAll(sl, desc, qty, rate, total, commision, total_commision, neat_total, delete);

    delete.setOnAction((e) -> {
        this.container.getChildren().remove(row);
        calculate();
    });

    this.container.getChildren().add(row);
    calculate();

}

From source file:com.github.drbookings.ui.controller.BookingDetailsController.java

private void addRowNetEarnings(final Pane content, final BookingBean be) {
    final HBox box = new HBox();
    box.setSpacing(boxSpacing);//from  www  . j  a  va 2  s  .  c  o  m
    box.setPadding(boxPadding);
    box.setAlignment(Pos.CENTER_LEFT);
    box.setFillHeight(true);
    final TextField grossEarningsExpression = new TextField(be.getGrossEarningsExpression());
    grossEarningsExpression.setPrefWidth(prefTextInputFieldWidth * 1.5);
    booking2GrossEarnings.put(be, grossEarningsExpression);
    final Text grossEarnings = new Text(decimalFormat.format(be.getGrossEarnings()));
    final TextFlow tf = new TextFlow(new Text("Gross Earnings: "), grossEarningsExpression, new Text(" = "),
            grossEarnings, new Text(""));
    box.getChildren().addAll(tf);
    if (be.getGrossEarnings() <= 0) {
        box.getStyleClass().addAll("warning", "warning-bg");
    }

    final HBox box2 = new HBox();
    box2.setSpacing(boxSpacing);
    box2.setPadding(boxPadding);
    box2.setAlignment(Pos.CENTER_LEFT);
    box2.setFillHeight(true);

    Text text = new Text("Amount received: ");
    TextField textField = new TextField();
    textField.setText(new NumberStringConverter().toString(be.getPaymentSoFar()));
    textField.setEditable(false);
    be.paymentSoFarProperty().addListener((c, o, n) -> {
        textField.setText(new NumberStringConverter().toString(n));
    });
    box2.getChildren().addAll(text, textField);
    content.getChildren().addAll(box, box2);

}

From source file:com.github.drbookings.ui.controller.BookingDetailsController.java

private void addRowFees(final Pane content, final BookingBean be) {
    final HBox box = new HBox();

    // configure box
    box.setSpacing(8);//from   w w  w  . ja  v  a 2s  .  com
    box.setPadding(boxPadding);
    box.setAlignment(Pos.CENTER);
    box.setFillHeight(true);

    // add cleaning fees
    final TextField cleaningFeesTextField = new TextField();
    Bindings.bindBidirectional(cleaningFeesTextField.textProperty(), be.cleaningFeesProperty(),
            new NumberStringConverter(decimalFormat));
    cleaningFeesTextField.setPrefWidth(prefTextInputFieldWidth);
    final TextFlow cleaningFeesTextFlow = new TextFlow(new Text("Cleaning Fees: "), cleaningFeesTextField,
            new Text(" "));
    box.getChildren().add(cleaningFeesTextFlow);

    // add cleaning costs

    final CleaningEntry ce = be.getCleaning();
    if (ce != null) {
        final TextField cleaningCostsTextField = new TextField();
        Bindings.bindBidirectional(cleaningCostsTextField.textProperty(), ce.cleaningCostsProperty(),
                new NumberStringConverter(decimalFormat));
        cleaningCostsTextField.setPrefWidth(prefTextInputFieldWidth);
        final TextFlow cleaningCostsTextFlow = new TextFlow(new Text("Cleaning Costs: "),
                cleaningCostsTextField, new Text(" "));
        box.getChildren().add(cleaningCostsTextFlow);
    } else {
        final TextField cleaningCostsTextField = new TextField("No Cleaning");
        cleaningCostsTextField.setEditable(false);
        cleaningCostsTextField.setPrefWidth(prefTextInputFieldWidth);
        final TextFlow cleaningCostsTextFlow = new TextFlow(new Text("Cleaning Costs: "),
                cleaningCostsTextField);
        cleaningCostsTextField.getStyleClass().add("warning");
        box.getChildren().add(cleaningCostsTextFlow);
    }

    // add service fees
    final TextField serviceFeesTextField = new TextField();
    Bindings.bindBidirectional(serviceFeesTextField.textProperty(), be.serviceFeeProperty(),
            new NumberStringConverter(decimalFormat));
    serviceFeesTextField.setPrefWidth(prefTextInputFieldWidth);
    final TextFlow serviceFeesAbsTextFlow = new TextFlow(new Text("Service Fees: "), serviceFeesTextField,
            new Text(" "));
    box.getChildren().add(serviceFeesAbsTextFlow);

    // add service fees percent
    final TextField serviceFeesPercentTextField = new TextField();
    Bindings.bindBidirectional(serviceFeesPercentTextField.textProperty(), be.serviceFeesPercentProperty(),
            new NumberStringConverter(decimalFormat));
    serviceFeesPercentTextField.setPrefWidth(prefTextInputFieldWidth);
    final TextFlow serviceFeesPercentTextFlow = new TextFlow(new Text("Service Fees: "),
            serviceFeesPercentTextField, new Text(" %"));

    box.getChildren().add(serviceFeesPercentTextFlow);

    // add box to parent
    content.getChildren().add(box);

}