Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8102251

Constructors for Bindings that take the bind() parameters

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • fx2.1
    • javafx
    • Any

      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...

            mheinrichs Michael Heinrichs (Inactive)
            jhendrikx John Hendrikx
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: