Untitled

mail@pastecode.io avatar
unknown
java
a year ago
853 B
1
Indexable
Never
        timer.scheduleAtFixedRate(new TimerTask() {
            @Override
            public void run() {
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        int prevLength = emails.size();

                        emails = mailClientModel.GetEmails(address);

                        int currLength = emails.size();
                        
                        if (currLength != prevLength) {
                            receivedMailsListView.getItems().clear();

                            for (Email email : emails) {
                                receivedMailsListView.getItems().add(email);
                            }
                        }
                    }
                });
            }
        }, 2000, 5000);