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)
-------------------------------------------------------
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)
- duplicates
-
JDK-8106501 stylesheet css with number arguments fails with a conversion exception
- Closed