I wonder if it is possible to make a progressbar with the appearance,"progressbar Animated bootstrap". With stripes going sideways.
相关问题
- I get an exception when trying to swap elements in
- JFX scale image up and down to parent
- Dragging an undecorated Stage in JavaFX
- JavaFX sample issue
- How to properly use Weld in JavaFX 2 application?
相关文章
- Low quality icon in taskbar of a Stage. JavaFX
- Loading custom font using JavaFX 8 and css
- Javafx Platform.runLater never running
- JavaFX scrolling table update performance degrades
- How to change the color of pane in javafx?
- Javafx select multiple rows
- TableView has more columns than specified
- Escape from a Number TextField in a JavaFX dialog
In another answer I have explained how to do this. Like jewelsea said, I animated the hole progress-bar with a timeline. But without a lookup or style change on runtime(both is not really recommended).
You must write a bit more css but then it runs smoothly and without much CPU usage.
Here the edited code from jewelsea:
File: StripedProgress.java
And the full CSS:
File: striped-progress.css
ProgressBar with Static Stripes
Here is a JavaFX ProgressBar which looks like a static striped progress bar from Bootstrap.
The stripe gradient is set entirely in css, the Java code is just a test harness.
File: striped-progress.css
File: StripedProgress.java
ProgressBar with Animated Stripes
JavaFX has good animation facilities which will allow you to animate the gradient within the progress bar if you wish.
One way to do that is to do a node lookup on the bar after the bar has been displayed on the screen and modify the style property of the bar in a Timeline, similar to the technique applied in: How to make an animation with CSS in JavaFX?
Personally, I find animated stripes on progress bars annoying.
Writing the actual code for this is left as an exercise for the reader.