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时,我想停止时间轴。 此代码不正在处理任何建议
的建议答案 0 :(得分:0)
你正在停止
javafx.application.Application.stop();
什么都不做,而是做
addRandomPeopleFrequently.stop();