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

Using Number in CSS: java.lang.Double cannot be cast to java.lang.Float

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • None
    • javafx
    • None

      Create a Style.css file:
      -------------------------------------------------------
      Circle { opacity: 0.5 }
      -------------------------------------------------------

      Create a JavaFX Script file:
      -------------------------------------------------------
      import javafx.stage.Stage;
      import javafx.scene.Scene;
      import javafx.scene.shape.Circle;
      import javafx.scene.paint.Color;


      Stage {
          title: "Application title"
          width: 250
          height: 280
          scene: Scene {
              stylesheets: ["{__DIR__}Style.css"]
              content: [
                  Circle {
                      centerX: 100
                      centerY: 100
                      radius: 10
                      stroke: Color.GREEN
                  }

              ]
          }
      }
      -------------------------------------------------------

      Run the File:

      standard-run:
      java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Float
              at com.sun.javafx.runtime.location.FloatVariable.set(FloatVariable.java:38)
              at javafx.reflect.FXLocal$VarMember.setValue(FXLocal.java:729)
              at com.sun.stylesheet.javafx.Attribute.setProperty(Attribute.java:153)
              at com.sun.stylesheet.javafx.FXObjectStyleSupport.setProperty(FXObjectStyleSupport.java:342)
              at com.sun.stylesheet.styleable.DefaultStyleable.setProperty(DefaultStyleable.java:168)
              at com.sun.stylesheet.PropertyManager.applyProperty(PropertyManager.java:594)
              at com.sun.stylesheet.PropertyManager.applyProperty(PropertyManager.java:555)
              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:282)
              at com.sun.stylesheet.Stylesheet.applyTo(Stylesheet.java:257)
              at javafx.scene.Scene.applyStylesheets$impl(Scene.fx:235)
              at javafx.scene.Scene.applyStylesheets(Scene.fx:43)
              at javafx.scene.Scene.userInit$(Scene.fx:220)
              at javafx.scene.Scene.initialize$(Scene.fx:43)
              at javafxapplication43.Main.javafx$run$(Main.fx:19)
              at javafxapplication43.Main.javafx$run$(Main.fx:19)

            kcr Kevin Rushforth
            alexsch Alexandr Scherbatiy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: