Message Text Line-Wrap works properly now

This commit is contained in:
DieGurke 2020-07-22 11:49:32 +02:00
parent 5258a7dc12
commit 8837273982

View File

@ -10,6 +10,7 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.ContextMenu; import javafx.scene.control.ContextMenu;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.MenuItem; import javafx.scene.control.MenuItem;
@ -107,6 +108,7 @@ public class MessageControl extends Label {
} }
// Creating the textLabel // Creating the textLabel
final var textLabel = new Label(message.getText()); final var textLabel = new Label(message.getText());
textLabel.setMaxWidth(430);
textLabel.setWrapText(true); textLabel.setWrapText(true);
vbox.getChildren().add(textLabel); vbox.getChildren().add(textLabel);
// Setting the message status icon and background color // Setting the message status icon and background color
@ -116,6 +118,7 @@ public class MessageControl extends Label {
vbox.getChildren().add(statusIcon); vbox.getChildren().add(statusIcon);
getStyleClass().add("own-message"); getStyleClass().add("own-message");
ownMessage = true; ownMessage = true;
hbox.setAlignment(Pos.CENTER_RIGHT);
} else { } else {
getStyleClass().add("received-message"); getStyleClass().add("received-message");
ownMessage = false; ownMessage = false;