Let's assume that I have a TextField and a Label
TextField customTextField
Label customLabel
I want to bind the customLabel
to the customTextField
's TextProperty. After doing so the customLabel
will be updated according to what the customTextField
contains. However, I want something a bit more than this. For example, if I enter the amount 15.0
I want it to update the customLabel
's text to 15.0/100.0
. Is there any way of doing this?
Thanks in advance.
Looks like you already figured it out, but to clarify for any who might come here looking, you can use something like this:
customLabel.textProperty().bind(
customTextField.textProperty().stringBinding { "$it/100.0" }
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.