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

Referencing a paint/color defined in CSS causes exception and warning

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: fx2.0
    • Fix Version/s: fx2.0
    • Component/s: javafx
    • Labels:
    • Environment:

      XP b40

      Description

      Define a paint constant in your CSS file as follows:

      .scene {
          palConstantFill: rgba(204,204,204,1.0);
      }

      Then reference that color somewhere else in your CSS file (for a background color or something), or reference it dynamically at runtime in your code via setStyle and receive the following exception/warning:

      WARNING: com.sun.javafx.css.StyleHelper lookup caught:
      java.lang.ClassCastException: java.lang.String cannot be cast to javafx.scene.paint.Paint
      at com.sun.javafx.scene.layout.region.StrokeBorder$BorderPaintConverter.convert(StrokeBorder.java:522)
      at com.sun.javafx.scene.layout.region.StrokeBorder$LayeredBorderPaintConverter.convert(StrokeBorder.java:496)
      at com.sun.javafx.scene.layout.region.StrokeBorder$LayeredBorderPaintConverter.convert(StrokeBorder.java:481)
      at com.sun.javafx.css.Value.convert(Value.java:243)
      at com.sun.javafx.css.StyleHelper.lookup(StyleHelper.java:934)
      at com.sun.javafx.css.StyleHelper.lookup(StyleHelper.java:868)
      at com.sun.javafx.css.StyleHelper.transitionToState(StyleHelper.java:670)
      .....
      WARNING: com.sun.javafx.css.StyleHelper lookup styleable = 'artificial' StyleableProperty {property: -fx-border-color, converter: LayeredBorderPaintType, initialValue: null}
      WARNING: com.sun.javafx.css.StyleHelper lookup resolved = <Value>
        <value values="1">
          <Value>
            <value values="4">
              <Value lookup="true">
                <value>palConstantFill</value>
                <converter>null</converter>
              </Value>
              <Value lookup="true">
                <value>palConstantFill</value>
                <converter>null</converter>
              </Value>
              <Value lookup="true">
                <value>palConstantFill</value>
                <converter>null</converter>
              </Value>
              <Value lookup="true">
                <value>palConstantFill</value>
                <converter>null</converter>
              </Value>
            </value>
            <converter>BorderPaintType</converter>
          </Value>
        </value>
        <converter>LayeredBorderPaintType</converter>
      </Value>

      I hope that there's a simple fix on my end for this, otherwise it's going to be tough to evaluate b40.

        Attachments

          Activity

            People

            • Assignee:
              dgrieve David Grieve (Inactive)
              Reporter:
              kmcintyrejfx Kyle McIntyre (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: