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

Unable to reset and reuse ColorPicker

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Incomplete
    • Affects Version/s: 7u45
    • Fix Version/s: 8
    • Component/s: javafx
    • Labels:
    • Environment:

      WindowsXP sp3 32bit
      jdk1.7.0_45

      Description

      I have had a problem to reuse ColorPicker because there is no way to reset its view (color box and text) to state matched value property.
      My scema is:
      1. MyPane is used on some form of dialog.
      2. User might want to pick some color but finally click Cancel on the form to dismiss dialog with no color applied.
      3. When I reopen the dialog, I reset it by calling myPaneInstance.setColor( originalColor );
      4. MyPane opens with ColorPicker showing last user selection rather then re-setted color. It also contradicts to color used by application and used by MyPreview class.
      {code}
      class MyPane extends Pane
      {
          private final ColorPicker colorPicker = new ColorPicker();
          private final MyPreview preview = new MyPreview();
          
          MyPane()
          {
              // next line is shown just for illustration purposes, implementation is different
              preview.colorProperty().bind( colorPicker.valueProperty() );
          }

          void setColor( Color color )
          {
              // colorPicker.setColor( color ); // does not update property
              colorPicker.valueProperty().setValue( color );
          }
      }
      {code}

      See also RT-22538 . Unfortunately, it was mixed with two issues and "resolved".

        Attachments

          Activity

            People

            • Assignee:
              jgiles Jonathan Giles
              Reporter:
              nvarankinjfx Nikolai Varankine (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: