Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple Digital gradient not working: Medusa 11.7 #226

Open
BurtonAlexand14 opened this issue Dec 29, 2024 · 0 comments
Open

Simple Digital gradient not working: Medusa 11.7 #226

BurtonAlexand14 opened this issue Dec 29, 2024 · 0 comments

Comments

@BurtonAlexand14
Copy link

// Code with workaround

	// @formatter:off
	Gauge g = GaugeBuilder.create()
			.skinType(SkinType.SIMPLE_DIGITAL)
			.foregroundBaseColor(Color.rgb(0, 222, 249))
			.barColor(Color.rgb(0, 222, 249))
			.title(text)
			.minValue(0.0)
			.maxValue(1.0)
			.gradientBarEnabled(true)
            .gradientBarStops(new Stop(0.00, Color.BLUE),
                              new Stop(0.25, Color.CYAN),
                              new Stop(0.50, Color.LIME),
                              new Stop(0.75, Color.YELLOW),
                              new Stop(1.00, Color.RED))
            .decimals(3)
			.build();
	// @formatter:on
	
            // Workaround, new skin set explicitly
	g.getSkin().dispose();
	g.setSkin(new SimpleDigitalSkin(g));
	
            // Without workaround, throws exception
	g.setValue(value.doubleValue());

After building the gauge calling setValue causes an exception:

Exception in thread "nioEventLoopGroup-3-1" java.lang.NullPointerException: Cannot invoke "eu.hansolo.medusa.tools.AngleConicalGradient.getImagePattern(javafx.scene.shape.Rectangle)" because "this.gradient" is null
at eu.hansolo.medusa.skins.SimpleDigitalSkin.setBar(SimpleDigitalSkin.java:207)
at eu.hansolo.medusa.skins.SimpleDigitalSkin.lambda$new$1(SimpleDigitalSkin.java:109)

The workaround is to set a new SimpleDigitalSkin explicitly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant