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

looked-up-color doesn't work unless it is defined in a CSS style sheet

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • None
    • 7-pool
    • javafx
    • Windows 7.

    Description

      According to http://download.oracle.com/javafx/2.0/api/javafx/scene/doc-files/cssref.html#typecolor

      "Looked-up Colors <looked-up-color>

      With looked-up colors you can refer to any other color property that is set on the current node or any of its parents. This is a very powerful feature, as it allows a generic palette of colors to be specified on the scene then used thoughout the application. If you want tochange one of those palette colors you can do so at any level in the scene tree and it will affect that node and all its decendents. Looked-up colors are not looked up until they are applied, so they are live and react to any style changes that might occur, such as replacing a palette color at runtime with the "style" property on a node."


      However if you attempt to define a looked-up-color via setStyle then the color is not found.
      e.g. this fails:
      rootNode.setStyle("myCustomColor: #ffee00");
      childNode.setStyle("-fx-background-color: myCustomColor;");

      The last sentence of the looked-up-color description, "...they are live and react to any style changes that might occur, such as replacing a palette color at runtime with the 'style' property on a node.", implies that this should work.

      The same color reference in a child node will work, if the looked-up-color is defined in the Scene's stylesheet.

      Attachments

        Issue Links

          Activity

            People

              dgrieve David Grieve
              swpalmer Scott Palmer
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: