HanSolo / medusa

A JavaFX library for Gauges
Apache License 2.0
692 stars 131 forks source link

Nullpointer Exception in LcdSkin.redraw at PrismTextLayout.java:1267 #128

Closed WolfgangFahl closed 7 years ago

WolfgangFahl commented 7 years ago

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException at com.sun.javafx.text.PrismTextLayout.layout(PrismTextLayout.java:1267) at com.sun.javafx.text.PrismTextLayout.ensureLayout(PrismTextLayout.java:223) at com.sun.javafx.text.PrismTextLayout.getBounds(PrismTextLayout.java:246) at javafx.scene.text.Text.getLogicalBounds(Text.java:358) at javafx.scene.text.Text.impl_computeLayoutBounds(Text.java:1115) at javafx.scene.Node$12.computeBounds(Node.java:3223) at javafx.scene.Node$LazyBoundsProperty.get(Node.java:9306) at javafx.scene.Node$LazyBoundsProperty.get(Node.java:9276) at javafx.scene.Node.getLayoutBounds(Node.java:3238) at eu.hansolo.medusa.skins.LcdSkin.updateBackgroundText(LcdSkin.java:464) at eu.hansolo.medusa.skins.LcdSkin.redraw(LcdSkin.java:691)

HanSolo commented 7 years ago

without a procedure on how to reproduce this bug, this description is useless.

WolfgangFahl commented 7 years ago

with a Platform.RunLater() things seem to work. I didn't now that this is not automatically injected by the binding framework ...

double currentSpeed=50.0+Math.random()*10; Platform.runLater(()->speed.setValue(currentSpeed));

HanSolo commented 7 years ago

You should make sure to call ui controls on the JavaFX Application Thread. When modifying a property you might want to use an AnimationTimer which always run on the JavaFX Application Thread.