0
Timeline addRandomPeopleFrequently = new Timeline(new KeyFrame(Duration.millis(20), new EventHandler<ActionEvent>() {  
            @Override  
            public void handle(ActionEvent event) {
                if(table.getItems().size()==0)
                {

                    try {
                        stop();
                    } catch (Exception e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }
                }
                int index = RNG.nextInt(table.getItems().size());
                count++;
                table.getItems().remove(index);
                e=System.currentTimeMillis() -s;
            }  
          }));  

          addRandomPeopleFrequently.setCycleCount(Animation.INDEFINITE);  
          addRandomPeopleFrequently.play();

我有这段代码,我想在我的表格大小变为 0 时停止时间轴。这段代码没有任何作用,建议做什么

4

1 回答 1

0

你在停下

javafx.​application.​Application.stop();

什么都不做,而是做

addRandomPeopleFrequently.stop();
于 2013-06-26T12:08:42.183 回答