To make the use of (usually) StringBinding a bit less cumbersum, please consider making it possible to provide the parameters for bind() in the constructor, like this:
new StringBinding(volumeProperty()) {
protected String computeValue() {
return "" + getVolume() + "%";
}
}
Although I suppose this comes close, but just look ugly:
new StringBinding() { { bind(volumeProperty()); }
protected String computeValue() {
return "" + getVolume() + "%";
}
}
There's probably a good reason why it was never considered, but I couldn't find a related issue. I know of Bindings.createStringBinding(), but unfortunately, its parameters are in the "wrong" order which makes code look odd when the anonymous inner class is not the last parameter...
new StringBinding(volumeProperty()) {
protected String computeValue() {
return "" + getVolume() + "%";
}
}
Although I suppose this comes close, but just look ugly:
new StringBinding() { { bind(volumeProperty()); }
protected String computeValue() {
return "" + getVolume() + "%";
}
}
There's probably a good reason why it was never considered, but I couldn't find a related issue. I know of Bindings.createStringBinding(), but unfortunately, its parameters are in the "wrong" order which makes code look odd when the anonymous inner class is not the last parameter...