diff --git a/client/src/main/java/envoy/client/ui/controller/ChatScene.java b/client/src/main/java/envoy/client/ui/controller/ChatScene.java index 9ea7c80..94984a8 100644 --- a/client/src/main/java/envoy/client/ui/controller/ChatScene.java +++ b/client/src/main/java/envoy/client/ui/controller/ChatScene.java @@ -15,6 +15,7 @@ import java.util.logging.Logger; import javafx.animation.RotateTransition; import javafx.application.Platform; import javafx.collections.FXCollections; +import javafx.collections.ObservableList; import javafx.collections.transformation.FilteredList; import javafx.fxml.FXML; import javafx.scene.Node; @@ -132,8 +133,8 @@ public final class ChatScene implements Restorable { private static final Image DEFAULT_ATTACHMENT_VIEW_IMAGE = IconUtil.loadIconThemeSensitive("attachment_present", 20); private static final int MAX_MESSAGE_LENGTH = 255; private static final int DEFAULT_ICON_SIZE = 16; - - private FilteredList chats; + + private FilteredList chats; /** * Initializes the appearance of certain visual components. @@ -245,7 +246,7 @@ public final class ChatScene implements Restorable { this.localDB = localDB; this.client = client; this.writeProxy = writeProxy; - + chats = new FilteredList<>(FXCollections.observableList(localDB.getChats())); chatList.setItems(chats); contactLabel.setText(localDB.getUser().getName()); @@ -552,7 +553,7 @@ public final class ChatScene implements Restorable { // Moving currentChat to the top Platform.runLater(() -> { chats.getSource().remove(currentChat); - chats.getSource().add(0, currentChat); + ((ObservableList) chats.getSource()).add(0, currentChat); chatList.getSelectionModel().select(0); localDB.getChats().remove(currentChat); localDB.getChats().add(0, currentChat); @@ -623,7 +624,7 @@ public final class ChatScene implements Restorable { updateRemainingCharsLabel(); postButton.setDisable(messageText.isBlank()); } - + @FXML private void searchContacts() { chats.setPredicate(contactSearch.getText().isBlank() ? c -> true