@Override public StringBinding asString(String format) { return delegate.asString(format); }
@Override public StringBinding asString() { return delegate.asString(); }
@Override public StringBinding asString(Locale locale, String format) { return delegate.asString(locale, format); }
private final static double FACTOR = -Math.log(5d) * 0.01; treeView.setCellFactory((t) -> new TreeCell<IntegerProperty>() { @Override protected void updateItem(IntegerProperty item, boolean empty) { super.updateItem(item, empty); if (empty || item == null) { textProperty().unbind(); backgroundProperty().unbind(); setText(null); setBackground(null); } else { textProperty().bind(item.asString()); backgroundProperty().bind(Bindings.createObjectBinding(() -> new Background(new BackgroundFill( Color.color(1, Math.exp(FACTOR * item.get()), 0, 1), CornerRadii.EMPTY, Insets.EMPTY)), item)); } } });
IntegerProperty score = new SimpleIntegerProperty(500); Text text = new Text("-"); // Bind score to text, to show on scene. text.textProperty().bind(score.asString()); score.set(700); // new value
private final Text showScore=new Text(); private final IntegerProperty playerPointCounter=new SimpleIntegerProperty(); private final IntegerProperty gameOverCounter=new SimpleIntegerProperty(); public void setTextField() { showScore.textProperty().bind(Bindings.concat("Score: ") .concat(playerPointCounter.asString()) .concat("\nMisses: ").concat(gameOverCounter.asString())); showScore.setLayoutX(25); showScore.setLayoutY(35); showScore.setFill(Color.WHITE); //Font family, weight, font size showScore.setFont(Font.font("Baskerville Old Face", FontWeight.BOLD, 20)); this.getChildren().add(showScore); } public void incrementPointCounter(){ playerPointCounter.set(playerPointCounter.get()+1); }
final IntegerProperty count = new SimpleIntegerProperty(0); Text text = new Text("-"); // Bind count to text, to show on scene. text.textProperty().bind(count.asString()); ChangeListener listener = new ChangeListener<Boolean>() { @Override public void changed(final ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { count.set(count.get() + (newValue ? 1 : -1)); if (count.get() >= 10) { System.out.println("exceeded max limit"); // Revert selection Platform.runLater(new Runnable() { @Override public void run() { ((BooleanProperty) observable).set(false); } }); } } }; for (final Card card : cards.getItems()) { card.selectedProperty().addListener(listener); }
Bindings.concat("Num clicks: ", nClickProperty.asString()) );
@Override protected void setupView() { setupCalendarControl(); setCalendarActionListener(); setupCalendarContextMenu(); // bind month and year labels to current values displayedMonth.addListener((observable, oldValue, newValue) -> laDisplayedMonth.setText( // getContext().getResources().getString("st.calview.months." + newValue.intValue()))); laDisplayedYear.textProperty().bind(displayedYear.asString()); // display the current day at startup onToday(null); }
IntegerProperty count = new SimpleIntegerProperty(); Label label = new Label(); label.textProperty().bind(count.asString("Count: %d"));
input.textProperty().bind(moneyTranfer.amountProperty().asString());
currValueText.textProperty().bind(initValueProperty.asString()); root.setBottom(currValueText);
public void start(Stage primaryStage) { timerLabel.textProperty().bind(count.asString()); timerLabel.setVisible(false);
}); Label nbBricks = new Label(); nbBricks.textProperty().bind(numberOfBricks.asString()); img = imageLoader.getImage("icons/minusIcon"); ImageView minusIcon = new ImageView(img);
row.add(new StaticTextTableCell(template)); control = new CoinPriceAlwaysVisible(); control.amountProperty().bind(treasury.donationsProperty().asString()); row.add(new ControlTableCell(control)); tableModel.add(row); row.add(new StaticTextTableCell(template)); control = new CoinPriceAlwaysVisible(); control.amountProperty().bind(treasury.cityGuardCostsProperty().asString()); row.add(new ControlTableCell(control)); tableModel.add(row); row.add(new StaticTextTableCell(template)); control = new CoinPriceAlwaysVisible(); control.amountProperty().bind(treasury.buildingCostsProperty().asString()); row.add(new ControlTableCell(control)); tableModel.add(row); row.add(new StaticTextTableCell(template)); control = new CoinPriceAlwaysVisible(); control.amountProperty().bind(treasury.outriggerCostsProperty().asString()); row.add(new ControlTableCell(control)); tableModel.add(row); row.add(new StaticTextTableCell(template)); control = new CoinPriceAlwaysVisible(); control.amountProperty().bind(treasury.siegeCostsProperty().asString()); row.add(new ControlTableCell(control)); tableModel.add(row);
if (ware.isBarrelSizedWare()) { BarrelAmountAlwaysVisible barrelAmount = new BarrelAmountAlwaysVisible(); barrelAmount.amountProperty().bind(needed.asString()); row.add(new ControlTableCell(barrelAmount)); } else { BaleAmountAlwaysVisible baleAmount = new BaleAmountAlwaysVisible(); baleAmount.amountProperty().bind(needed.asString()); row.add(new ControlTableCell(baleAmount));
Text capacityTxt = new Text(); capacityTxt.getStyleClass().add("dialogText"); capacityTxt.textProperty().bind(office.capacityProperty().asString()); row.add(new ControlTableCell(capacityTxt)); baleAmount = new BaleIconView(); Text otherTxt = new Text(); otherTxt.getStyleClass().add("dialogText"); otherTxt.textProperty().bind(storage.rentOutStorageProperty().asString()); row.add(new ControlTableCell(otherTxt)); BarrelIconView barrelAmount = new BarrelIconView(); Text nbGuardsTxt = new Text(); nbGuardsTxt.getStyleClass().add("dialogText"); nbGuardsTxt.textProperty().bind(storage.numberGuardsProperty().asString()); row.add(new ControlTableCell(nbGuardsTxt)); Image plus = imageLoader.getImage("icons/plusIcon");
if (ware.isBarrelSizedWare()) { BarrelAmountAlwaysVisible barrelAmount = new BarrelAmountAlwaysVisible(); barrelAmount.amountProperty().bind(needed.asString()); row.add(new ControlTableCell(barrelAmount)); } else { BaleAmountAlwaysVisible baleAmount = new BaleAmountAlwaysVisible(); baleAmount.amountProperty().bind(needed.asString()); row.add(new ControlTableCell(baleAmount));
amount.amountProperty().bind(autoTrading.amountProperty(ware).asString()); row.add(new ControlTableCell(amount)); } else { BaleAmountAlwaysVisible amount = new BaleAmountAlwaysVisible(); amount.amountProperty().bind(autoTrading.amountProperty(ware).asString()); row.add(new ControlTableCell(amount)); price.amountProperty().bind(autoTrading.priceProperty(ware).asString()); price.visibleProperty().bind(new VisibleTradeTypeBinding(autoTrading.tradingTypeProperty(ware))); row.add(new ControlTableCell(price));