JavaFX Medusa仪表显示阈值TileKpiSkin
我正在尝试使用JavaFX库中的JavaFX Medusa仪表显示阈值TileKpiSkin,java,javafx,Java,Javafx,我正在尝试使用JavaFX库中的仪表: 但是,当我尝试构建它时,我得到了以下结果: 如您所见,仪表不显示阈值。为什么会这样 这是我用来创建仪表的代码: public static Gauge e(String name, int value, int maxValue ) { Gauge gauge = new Gauge(); //gauge.setSectionIconsVisible(false); gauge.setPrefSize(300, 300);
仪表
:
但是,当我尝试构建它时,我得到了以下结果:
如您所见,仪表不显示阈值。为什么会这样
这是我用来创建仪表的代码:
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;
}
任何帮助都会很棒。您应该查看所使用皮肤的源代码,文本设置为透明,这就是为什么在矩形中看不到任何内容:
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());
请在你的问题中加入一个能展示你所阐述的问题的例子;这将允许其他人在上下文中检查您的问题。如果我将(sectionsVisible?Color.TRANSPARENT:gauge.getBackgroundPaint())设置为更简单的Color.YELLOW,它仍然不起作用