I'm using the Gauge
from Medusa to show battery percentage for my JavaFX project. After some iteration of updating I'm getting this error.
Here is the error I'm getting.
Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space
at java.base/java.util.Arrays.copyOf(Arrays.java:3481)
at [email protected]/com.sun.javafx.sg.prism.GrowableDataBuffer.putObject(GrowableDataBuffer.java:417)
at [email protected]/javafx.scene.canvas.GraphicsContext.writeText(GraphicsContext.java:782)
at [email protected]/javafx.scene.canvas.GraphicsContext.fillText(GraphicsContext.java:1648)
at eu.hansolo.medusa.tools.Helper.drawRadialTickMarks(Helper.java:971)
at eu.hansolo.medusa.skins.GaugeSkin.redraw(GaugeSkin.java:1095)
at eu.hansolo.medusa.skins.GaugeSkinBase.handleEvents(GaugeSkinBase.java:60)
at eu.hansolo.medusa.skins.GaugeSkin.handleEvents(GaugeSkin.java:305)
at eu.hansolo.medusa.skins.GaugeSkinBase.lambda$registerListeners$2(GaugeSkinBase.java:52)
at eu.hansolo.medusa.skins.GaugeSkinBase$$Lambda$203/0x00000001002c06c0.onUpdateEvent(Unknown Source)
at eu.hansolo.medusa.Gauge.fireUpdateEvent(Gauge.java:5887)
at eu.hansolo.medusa.Gauge.setBarColor(Gauge.java:3492)
at com.log9materials.utilities.ui_utilities.FXUtilities$16.run(FXUtilities.java:388)
at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
at [email protected]/com.sun.javafx.application.PlatformImpl$$Lambda$104/0x0000000100143218.run(Unknown Source)
at java.base/java.security.AccessController.executePrivileged(AccessController.java:776)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
at [email protected]/com.sun.javafx.application.PlatformImpl$$Lambda$103/0x0000000100141fc8.run(Unknown Source)
at [email protected]/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at [email protected]/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at [email protected]/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
at [email protected]/com.sun.glass.ui.win.WinApplication$$Lambda$92/0x0000000100130d10.run(Unknown Source)
at java.base/java.lang.Thread.run(Thread.java:833)
Here is my code.
Platform.runLater(new Runnable() {
@Override
public void run() {
if (gaugeIndicator != null) {
gaugeIndicator.setValue(doubleValue);
if (doubleValue <= 10) {
gaugeIndicator.setBarColor(Color.RED);
} else if (doubleValue <= 20) {
gaugeIndicator.setBarColor(Color.YELLOW);
} else if (doubleValue <= 80) {
gaugeIndicator.setBarColor(Color.ORANGE);
} else {
gaugeIndicator.setBarColor(Color.GREEN);
}
}
}
}