Platform.runLater and Task in JavaFX

前端 未结 4 550
孤独总比滥情好
孤独总比滥情好 2020-11-22 08:54

I have been doing some research on this but I am still VERY confused to say the least.

Can anyone give me a concrete example of when to use Task and whe

4条回答
  •  逝去的感伤
    2020-11-22 09:20

    It can now be changed to lambda version

    @Override
    public void actionPerformed(ActionEvent e) {
        Platform.runLater(() -> {
            try {
                //an event with a button maybe
                System.out.println("button is clicked");
            } catch (IOException | COSVisitorException ex) {
                Exceptions.printStackTrace(ex);
            }
        });
    }
    

提交回复
热议问题