我正在尝试使用Medusa JavaFX库中的这个Gauge:

然而,当我尝试构建它时,我得到了这样的结果:

正如您所看到的,仪表没有显示阈值。为什么会这样呢?
这是我用来创建仪表的代码:
public static Gauge e(String name, int value, int maxValue ) {
Gauge gauge = new Gauge();
//gauge.setSectionIconsVisible(false);
gauge.setPrefSize(300, 300);
gauge.setSkin(new TileKpiSkin(gauge));
gauge.setMaxValue(100);
gauge.setThreshold(60);
gauge.setTitle("this is it");
gauge.setValue(25);
gauge.setValueColor(Color.WHITE);
gauge.setTitleColor(Color.WHITE);
gauge.setThresholdVisible(true);
gauge.setThresholdColor(Color.RED);
//gauge.setSectionIconsVisible(false);
//gauge.setSectionsVisible(false);
return gauge;
}任何帮助都是很棒的。
发布于 2019-02-19 04:29:25
您应该查看您正在使用的皮肤的源代码,文本设置为透明,这就是为什么您在矩形中看不到任何东西的原因:
thresholdRect = new Rectangle();
thresholdRect.setFill(sectionsVisible ? GRAY : gauge.getThresholdColor());
enableNode(thresholdRect, gauge.isThresholdVisible());
thresholdText = new Text(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getThreshold()));
thresholdText.setFill(sectionsVisible ? Color.TRANSPARENT : gauge.getBackgroundPaint());
enableNode(thresholdText, gauge.isThresholdVisible());https://stackoverflow.com/questions/54744349
复制相似问题