如何在 JavaFX 中创建自定义 ProgressIndicator?

杰夏普

帮助我创建一个与此链接图像完全相同的进度指示器:https : //imagizer.imageshack.com/img924/1038/rF9o1y.png

这个进度指示器是不确定的。

杰夏普

我已经解决了我的问题,感谢@Slaw 的想法。

public class AnimatedNeonCircle extends Circle {

private     final       RotateTransition      transition;

public AnimatedNeonCircle (AnimatedNeonCircle.Animation a, double radius, double strokeWidth, Double... dashedArray) {
    this.transition = new RotateTransition (a.durationProperty ().get (), AnimatedNeonCircle.this);
    this.transition.setCycleCount (a.cycleCountProperty ().get ());
    this.transition.setAutoReverse (a.autoReverseProperty ().get ());
    this.transition.setByAngle (radius);

    super.setFill (Color.TRANSPARENT);
    super.setStroke (Color.CYAN);
    super.setStrokeWidth (strokeWidth);
    super.setEffect (new Glow (0.4));
    super.setRadius (radius);
    super.getStrokeDashArray ().setAll (dashedArray);
}

public void play () {
    transition.play ();
}

// =======================================================================

public static class Animation {

    private     final       SimpleObjectProperty <Duration>     duration        = new SimpleObjectProperty <> ();
    private     final       SimpleIntegerProperty               cycleCount      = new SimpleIntegerProperty ();
    private     final       SimpleBooleanProperty               autoReverse     = new SimpleBooleanProperty ();

    public Animation (Duration duration, int cycleCount, boolean autoReverse) {
        this.duration.set (duration);
        this.cycleCount.set (cycleCount);
        this.autoReverse.set (autoReverse);
    }

    public SimpleObjectProperty <Duration> durationProperty () { return duration; }
    public SimpleIntegerProperty cycleCountProperty () { return cycleCount; }
    public SimpleBooleanProperty autoReverseProperty () { return autoReverse; }

}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在Javafx中的窗格中心显示ProgressIndicator

如何在java中动态创建自定义xml元素(或自定义javafx场景控件)

在TableView JavaFX中为ProgressIndicator实现S3 ProgressListener

如何在JavaFX 8中创建自定义3d模型?

如何在 JavaFx 中为自定义组件创建属性?

如何在JavaFX CSS中创建自定义边框样式?

如何在JavaFX中从CSS设置自定义字体?

如何在JavaFX的TableView中自定义setCellValueFactory的功能

如何在 JavaFX 中制作自定义 LineChart 控件?

JavaFX-如何创建简单的自定义绘制控件?

使用Javafx达到特定条件时如何将ProgressIndicator更改为图标

如何在javafx中使用fxml创建自定义弹出窗口?

具有progressindicator的JavaFX Thread不旋转,在非FXThread中完成的工作

如何使用自定义对象在JavaFX中填充ListView?

如何在 JavaFX 中的 ListView 中设置自定义控件的样式

如何在JavaFX自定义控件中摆脱这些CSS警告?

如何在JavaFx中自定义自动完成文本字段建议

javafx datepicker如何自定义

(JavaFX FXML)在尝试创建自定义按钮时,如何获取图像以完全填充按钮?

如何在Swift中创建自定义UITableViewCell类?

如何在ActiveAdmin gem中创建自定义页面

如何在Joomla中创建自定义联系表单?

如何在R Highcharter中创建自定义形状

如何在 Python 中创建自定义错误消息

如何在ReactiveCocoa 4中创建自定义信号?

如何在框架中创建自定义方块

如何在 swiftUI 中创建自定义形状

如何在Java中创建大型自定义光标?

如何在SQL中创建自定义缩写?