Timeline timeline = new Timeline( new KeyFrame(Duration.seconds(1.0), e -> { /* * read new data and update GUI nodes here ... */ }) ); timeline.setCycleCount(Timeline.INDEFINITE); timeline.play();
If you use FXML, a good point to call this piece of code would be in your FXML controller class:
public class ControllerForFXML implements Initializable { @Override void initialize(URL location, ResourceBundle resources) { /* * Timeline code from above here ... */ } }
No comments:
Post a Comment