labelled the name of the room when in it

This commit is contained in:
Clément
2025-03-12 23:34:08 +01:00
parent 631cd25a9d
commit 67124f4731
2 changed files with 19 additions and 6 deletions

View File

@@ -44,6 +44,9 @@ public class ClientGuiController implements ClientListener {
@FXML
private ScrollPane chatPane;
@FXML
private Label roomName;
public void setClient(Client client) {
this.client = client;
}
@@ -183,11 +186,13 @@ public class ClientGuiController implements ClientListener {
*/
private void createChatEnv(String roomName) {
Platform.runLater(() -> {
this.roomName.setText("Room: " + roomName);
chatList.getChildren().clear();
chatInput.getChildren().clear();
Button leaveButton = new Button("Leave room");
leaveButton.setOnAction(event -> {
client.SendLeaveRoom();
this.roomName.setText("");
chatList.getChildren().clear();
chatInput.getChildren().clear();
});

View File

@@ -12,7 +12,7 @@
<BorderPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="client.ClientGuiController"
prefHeight="400.0" prefWidth="600.0" styleClass="vue-container" fx:id="vueContainer">
prefHeight="400.0" prefWidth="600.0" fx:id="vueContainer">
<top>
<HBox alignment="CENTER" styleClass="logo-box">
<padding>
@@ -25,8 +25,8 @@
</HBox>
</top>
<left>
<ScrollPane prefWidth="200.0" styleClass="rooms-pane" fx:id="roomsPane" fitToWidth="true">
<VBox fx:id="rooms" spacing="10.0" alignment="CENTER" VBox.vgrow="ALWAYS">
<ScrollPane prefWidth="200.0" fitToWidth="true">
<VBox spacing="10.0" alignment="CENTER" VBox.vgrow="ALWAYS">
<Label text="Rooms" styleClass="rooms-label"/>
<VBox fx:id="roomList" styleClass="rooms-list" spacing="5.0" VBox.vgrow="ALWAYS" alignment="CENTER"/>
</VBox>
@@ -34,15 +34,23 @@
</left>
<center>
<BorderPane>
<top>
<HBox alignment="CENTER">
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
</padding>
<Label fx:id="roomName" style="-fx-font-size: 18px; -fx-font-weight: bold;"/>
</HBox>
</top>
<center>
<ScrollPane styleClass="chat-pane" fx:id="chatPane" fitToWidth="true">
<VBox fx:id="chat" spacing="10.0">
<ScrollPane fx:id="chatPane" fitToWidth="true">
<VBox spacing="10.0">
<VBox fx:id="chatList" styleClass="chat-list" spacing="5.0" VBox.vgrow="ALWAYS"/>
</VBox>
</ScrollPane>
</center>
<bottom>
<HBox fx:id="chatInput" styleClass="chat-input" spacing="5.0" style="-fx-padding: 10;" />
<HBox fx:id="chatInput" spacing="5.0" style="-fx-padding: 10;" />
</bottom>
</BorderPane>
</center>