Помогите мне создать индикатор прогресса точно так же, как на изображении по этой ссылке: 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; }
}
Вопрос о том, как создать совершенно новый вид элемента управления с нуля, слишком широк для Stack Overflow. Существуют книги, посвященные созданию пользовательских элементов управления. Сначала попробуйте реализовать это самостоятельно, а затем задайте вопрос, если столкнетесь с проблемой специфический. Основная идея состоит в том, чтобы создать собственный
Skin
и применить его к вашемуProgressIndicator
. Ваше изображение выглядит так, будто это дваArc
напротив друг друга. Или даже всего одинArc
со штриховой чертой.