JavaFX Medusa Gauges 显示阈值 TileKpiSkin

标签 java javafx

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

Picure of gauge

但是当我尝试构建它时,我得到了这个结果:

Rendered 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;

}

任何帮助都会很棒。

最佳答案

您应该查看您正在使用的皮肤的源代码,文本设置为透明,这就是为什么您在矩形中看不到任何内容:

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());

关于JavaFX Medusa Gauges 显示阈值 TileKpiSkin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54744349/

相关文章:

Java 应用程序仅在事件线程上允许此操作错误

css - JavaFx 选项卡 - 外观与 SceneBuilder 不同

java - 用 Guava 合并范围

java - 清除/取消设置系统属性 maven.compiler.release 以便它不再存在

java - 将 Oracle DB 中的时区偏移量作为单独的字段存储

Java Thread.currentThread().setUncaughtExceptionHandler() 不适用于 JUNIT?

java - 将 DatePicker 中的数据添加到 DB Javafx 中

java - 过滤 tableView 在特定列中留下一些数据

Node.js VS。用于简单客户端应用程序的 JavaFX(从服务器打印出消息)

java - 如何根据列值的类型使 PreparedStatement.setXXX() 动态化