Pet*_*zov 2 java javafx javafx-2 javafx-8
我想为Java 7编写这段代码.
timeline.setOnFinished(actionEvent -> Platform.runLater(() -> {
POPUP.hide();
popups.remove(POPUP);
}));
Run Code Online (Sandbox Code Playgroud)
我写了这个:
timeline.setOnFinished(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent arg0) {
POPUP.hide();
popups.remove(POPUP);
}
});
Run Code Online (Sandbox Code Playgroud)
但我不知道在哪里插入其余的代码.
我必须插入Platform.runLater(()哪里?
你可以尝试这样的事情:
timeline.setOnFinished(new EventHandler<ActionEvent>(){
public void handle(final ActionEvent e){
Platform.runLater(
new Runnable(){
public void run(){
POPUP.hide();
popups.remove(POPUP);
}
}
);
}
});
Run Code Online (Sandbox Code Playgroud)