Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javafx.animation.AnimationTimer;
- import javafx.application.Application;
- import javafx.collections.FXCollections;
- import javafx.collections.ObservableList;
- import javafx.scene.chart.XYChart;
- import javafx.stage.Stage;
- import java.util.Random;
- import java.util.concurrent.ConcurrentLinkedQueue;
- public class ExceptionTest extends Application {
- @Override
- public void start(Stage primaryStage) throws Exception {
- // Data
- XYChart.Series<Double, Double> series = new XYChart.Series<>();
- ConcurrentLinkedQueue<XYChart.Data<Double, Double>> fullDataQueue = new ConcurrentLinkedQueue<>();
- ObservableList<XYChart.Data<Double, Double>> chartData = FXCollections.observableArrayList();
- series.setData(chartData);
- // Start adding data
- final Random random = new Random();
- for(int n = 0; n < 10000; ++n){
- fullDataQueue.add(new XYChart.Data<>((double)n, random.nextDouble()));
- }
- new AnimationTimer(){
- @Override
- public void handle(long now) {
- for (XYChart.Data<Double, Double> data : fullDataQueue){
- chartData.add(data);
- }
- }
- }.start();
- System.out.println("Done testSeriesAddInAnimator()!");
- }
- public static void main(String[] args) {
- launch(args);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement