diff --git a/src/main/java/envoy/client/ui/MessageListCell.java b/src/main/java/envoy/client/ui/MessageListCell.java index 721224c..22aa188 100644 --- a/src/main/java/envoy/client/ui/MessageListCell.java +++ b/src/main/java/envoy/client/ui/MessageListCell.java @@ -31,7 +31,7 @@ public class MessageListCell extends ListCell { private static final DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm"); private static Map statusImages; - private static User user; + private static User client; static { try { @@ -55,7 +55,7 @@ public class MessageListCell extends ListCell { setGraphic(null); } else { final var cell = new VBox(new Label(dateFormat.format(message.getCreationDate())), new Label(message.getText())); - if (message.getRecipientID() == user.getID()) { + if (message.getRecipientID() == client.getID()) { cell.getChildren().add(new Label("", new ImageView(statusImages.get(message.getStatus())))); cell.getStyleClass().add("own-message"); } else cell.getStyleClass().add("received-message"); @@ -65,8 +65,8 @@ public class MessageListCell extends ListCell { } /** - * @param user the user to set + * @param client the user who chats with another person * @since Envoy Client v0.1-beta */ - public static void setUser(User user) { MessageListCell.user = user; } + public static void setUser(User client) { MessageListCell.client = client; } } diff --git a/src/main/java/envoy/client/ui/controller/ChatScene.java b/src/main/java/envoy/client/ui/controller/ChatScene.java index c1fb678..017e58f 100644 --- a/src/main/java/envoy/client/ui/controller/ChatScene.java +++ b/src/main/java/envoy/client/ui/controller/ChatScene.java @@ -342,14 +342,12 @@ public final class ChatScene { @FXML private void copyAndPostMessage() { - try { - final var messageText = messageTextArea.getText(); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(messageText), null); - postMessage(); - messageTextArea.setText(messageText); - updateRemainingCharsLabel(); - postButton.setDisable(messageText.isBlank()); - } catch (final NullPointerException e) {} + final var messageText = messageTextArea.getText(); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(messageText), null); + postMessage(); + messageTextArea.setText(messageText); + updateRemainingCharsLabel(); + postButton.setDisable(messageText.isBlank()); } }