Questions tagged [javafx-bindings]

13 questions
9
votes
2 answers

How to bind a value to an ObservableList's size?

I want to bind a value to the ObservableList's size to know its size and also to know if it has multiple values private ObservableList strings = FXCollections.observableArrayList();
msj121
  • 2,702
  • 2
  • 25
  • 46
6
votes
1 answer

JavaFX: Initial value of bidirectional binding

What happens when I do binding for these two properties? ObjectProperty propertyA = new SimpleObjectProperty<>(); ObjectProperty propertyB = new SimpleObjectProperty<>(); propertyA.set(new ObjectA()); propertyB.set(new…
Jai
  • 7,616
  • 2
  • 17
  • 43
5
votes
1 answer

Why does binding a TextField to a property which is being updated on another thread end up with the application throwing errors?

I have a javafx application where I have multiple tabs (timer, stopwatch, clock) each with a separate Controller, and the user is able to add and independently start multiple timers using a start/stop button. I tried binding a TextField to a…
3
votes
1 answer

Bind CheckBoxTableCell to BooleanBinding

I want to bind a CheckBox in a TableViewCell to a BooleanBinding. The following sample consists of a TableView with a column name and isEffectiveRequired. The checkbox in the column is bound to the Expression: isRequired.or(name.isEqualTo("X")) So…
kfaria
  • 147
  • 9
2
votes
1 answer

JavaFX binding only applied after resizing the window

When I run the following code in the start method of my Main (JavaFX) class I get weird results. The window gets displayed but pane (with a green border) has a width of 0. It is supposed to have the same width as the container's height since I…
staad
  • 726
  • 8
  • 18
2
votes
2 answers

Binding to a ObservableValue instead of an ObservableList with EasyBind

I've got a master/detail panel with ModelItem items. Each ModelItem has a ListProperty, and each ModelItemDetail has a few StringPropertys. In the detail panel, I want to show a Label that will have its text bounded to and derived…
Xavi López
  • 26,413
  • 11
  • 94
  • 146
2
votes
1 answer

JavaFX: Binding to insets

I am pretty new to JavaFX and is fascinated by the binding capability. However, I could not figure out how to bind to the margin/padding of a node. Currently, I am trying to make a textbox (or TextField) that has an image on the left. I made a…
Jai
  • 7,616
  • 2
  • 17
  • 43
1
vote
1 answer

JavaFX complex string binding

I'm new to JavaFX and was wondering if the Bindings API allowed an easier way to achieve the following. Consider a model that contains a database that may be null (because the database loads asynchronously) and a view that displays a label status…
Xunkar
  • 85
  • 10
1
vote
2 answers

JavaFX Disable TableColumn based on checkbox state

Am looking to disable a TableColumn tableColumn based on a field value in the CustomObject only when the TableColumn tableColumnTwo checkbox is checked. I can disable the textbox inside public void…
John C
  • 1,647
  • 3
  • 23
  • 40
1
vote
0 answers

Reverse select binding - possible?

I have a case that requires an object property's sub-property to be bound automatically to some defined property, but unbind old and rebind new on any change in the parent property; namely reverse select binding. For illustration only (my case is…
Mordechai
  • 13,232
  • 1
  • 32
  • 69
1
vote
1 answer

How to get BooleanBinding from comparing 2 DatePickers?

I have two DatePickers and one Button on the GUI. I need to disable the button whenever the first datePicker has a date that is NOT before the second datePicker's date. i.e. before is false in the following snippet: LocalDate date1 =…
Eng.Fouad
  • 107,075
  • 62
  • 298
  • 390
0
votes
2 answers

Timer in JavaFX updating Label (Bindings)

I want to add a clock to my application that tells how long you have been doing the task. To simplify it, I have included a counter that increments every second in a new thread and update the label 'setTimer' with the counter number. For this I have…
Jens
  • 5
  • 1
  • 1
-1
votes
2 answers

How to not lose decimal places when doing "longProperty1.divide(longProperty2)"?

I have two LongProperty (there are no decimal places in a long) variables (longProperty1 and longProperty2). I need to divide them and I need to keep the division result in a DoubleProperty (there are decimal places in a double) variable (result)…
Douglas
  • 101
  • 4