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

CSS paint style "radial" does not convert to a RadialGradient paint

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • fx1.3
    • fx1.1
    • javafx
    • 1.1

      When using the "radial" css style for a paint, the runtime errors:

      ========= Foo.fx =============
      import javafx.stage.Stage;
      import javafx.scene.*;
      import javafx.scene.paint.*;
      import javafx.scene.shape.Circle;

      public class Foo extends CustomNode {

          public var color: Paint = Color.BLACK;

          public override function create(): Node {
              Circle {
                  centerX: 100,
                  centerY: 100
                  radius: 50
                  fill: bind color
              };
          }
      }

      function run(args: String[] ) {
          Stage {
              title: "MyApp"
              scene: Scene {
                  width: 200
                  height: 200
                  content: [
                      Foo {
                          //style: "color: linear (0%,0%) to (100%,100%) stops (0.00,red),(1.00, blue);"
                          style: "color: radial (0%,0%),100% focus(25%,25%) stops (0.00,red),(1.00, blue);"
                      }
                  ]
              }
          }
      }
      ===================

      Error:

      ===================
      Failed to parse style color: radial (0%,0%),100% focus(25%,25%) stops (0.00,red),(1.00, blue); on node Foo [boundsInLocal=Rectangle2D [minX = 0.0, minY=0.0, maxX=0.0, maxY=0.0, width=0.0, height=0.0], boundsInParent=Rectangle2D [minX = 0.0, minY=0.0, maxX=0.0, maxY=0.0, width=0.0, height=0.0]
      com.sun.stylesheet.StylesheetException: unable to convert string 'radial (0%,0%),100% focus(25%,25%) stops (0.00,red),(1.00, blue)' to a color
              at com.sun.stylesheet.types.AbstractColorConverter.convertFromString(AbstractColorConverter.java:123)
              at com.sun.stylesheet.javafx.ColorConverter.convertFromString(ColorConverter.java:44)
              at com.sun.stylesheet.types.TypeManager.convertFromString(TypeManager.java:486)
              at com.sun.stylesheet.javafx.PaintConverter.convertFromString$impl(PaintConverter.fx:41)
              at com.sun.stylesheet.javafx.PaintConverter.convertFromString(PaintConverter.fx:29)
              at com.sun.stylesheet.types.TypeManager.convertFromString(TypeManager.java:486)
              at com.sun.stylesheet.styleable.DefaultStyleable.convertPropertyFromString(DefaultStyleable.java:158)
              at com.sun.stylesheet.Declaration.convertValue(Declaration.java:76)
              at com.sun.stylesheet.Declaration.applyTo(Declaration.java:91)
              at com.sun.stylesheet.Rule.applyTo(Rule.java:221)
              at com.sun.stylesheet.Stylesheet.applyTo(Stylesheet.java:277)
              at com.sun.stylesheet.Stylesheet.applyTo(Stylesheet.java:257)
              at javafx.scene.Node.updateCSS$impl(Node.fx:496)
              at javafx.scene.Node.updateCSS(Node.fx:201)
              at javafx.scene.Node.postInit$(Node.fx:613)
              at javafx.scene.CustomNode.postInit$(CustomNode.fx:64)
              at Foo.postInit$(Foo.fx:6)
              at Foo.initialize$(Foo.fx:6)
              at Foo.javafx$run$(Foo.fx:27)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.netbeans.modules.javafx.preview.CodeUtils.run(CodeUtils.java:201)
              at org.netbeans.modules.javafx.preview.CodeUtils.run(CodeUtils.java:182)
              at org.netbeans.modules.javafx.preview.CodeUtils.run(CodeUtils.java:130)
              at org.netbeans.modules.javafx.preview.Preview$PreviewSideServer.body(Preview.java:397)
              at org.netbeans.modules.javafx.preview.Preview$PreviewSideServer$6.run(Preview.java:487)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

            dgrieve David Grieve
            jclarke Jim Clarke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: