Skip to content
Snippets Groups Projects
Commit 3bd0aff8 authored by Alexis Durgnat's avatar Alexis Durgnat :milky_way:
Browse files

Extracted color of chat message in parameters

parent 8ea566d3
No related branches found
No related tags found
1 merge request!21*poof* final version
...@@ -156,9 +156,9 @@ public class MainWindowController implements Initializable { ...@@ -156,9 +156,9 @@ public class MainWindowController implements Initializable {
* Draws a newly received message * Draws a newly received message
* @param message The message to draw * @param message The message to draw
*/ */
private void drawMessage(User user, String message, String image){ private void drawMessage(User user, String message, String image, Color color){
Pane p = new Pane(); Pane p = new Pane();
setChatPanelStyle(p); setChatPanelStyle(p, color);
Image lblImg = new Image(Main.class.getResourceAsStream(image)); Image lblImg = new Image(Main.class.getResourceAsStream(image));
Label msg = new Label(); Label msg = new Label();
msg.setWrapText(true); msg.setWrapText(true);
...@@ -174,13 +174,13 @@ public class MainWindowController implements Initializable { ...@@ -174,13 +174,13 @@ public class MainWindowController implements Initializable {
chatContainer.getChildren().add(p); chatContainer.getChildren().add(p);
} }
private void setChatPanelStyle(Pane p) { private void setChatPanelStyle(Pane p, Color color) {
p.setBackground( p.setBackground(
new Background( new Background(
new BackgroundFill( new BackgroundFill(
new LinearGradient(0, 0, 0, 1, true, new LinearGradient(0, 0, 0, 1, true,
CycleMethod.NO_CYCLE, CycleMethod.NO_CYCLE,
new Stop(1, AppConfig.COLOR_BLUE_10_OPACITY), new Stop(1, color),
new Stop(0, Color.WHITE) new Stop(0, Color.WHITE)
), ),
new CornerRadii(5), new CornerRadii(5),
...@@ -265,7 +265,7 @@ public class MainWindowController implements Initializable { ...@@ -265,7 +265,7 @@ public class MainWindowController implements Initializable {
chatMessage -> { chatMessage -> {
Platform.runLater(() -> { Platform.runLater(() -> {
String message = chatMessage.getUser().toString() + ": " + chatMessage.getMessage(); String message = chatMessage.getUser().toString() + ": " + chatMessage.getMessage();
drawMessage(chatMessage.getUser(), message, AppConfig.CHAT_MESSAGE_ICON); drawMessage(chatMessage.getUser(), message, AppConfig.CHAT_MESSAGE_ICON, AppConfig.COLOR_BLUE_10_OPACITY);
}); });
}, },
chatMessage -> !(app.getUser().get().getIgnoredUserList().contains(chatMessage.getUser())) chatMessage -> !(app.getUser().get().getIgnoredUserList().contains(chatMessage.getUser()))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment