Basic structure for GUI

This commit is contained in:
Clément
2025-03-05 23:29:58 +01:00
parent f87145ed69
commit 6950810b95
3 changed files with 44 additions and 6 deletions

View File

@@ -2,18 +2,32 @@ package client;
import javafx.animation.RotateTransition; import javafx.animation.RotateTransition;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.shape.Arc; import javafx.scene.shape.Arc;
import javafx.stage.Stage;
import javafx.util.Duration; import javafx.util.Duration;
import java.io.IOException;
import static utilities.FxUtilities.centerStage;
public class ClientLoading { public class ClientLoading {
@FXML @FXML
private Arc spinnerArc; private Arc spinnerArc;
public void initialize() { public void initialize() throws IOException, InterruptedException {
// Création de l'animation de rotation // Création de l'animation de rotation
RotateTransition rotate = new RotateTransition(Duration.seconds(1), spinnerArc); RotateTransition rotate = new RotateTransition(Duration.seconds(1), spinnerArc);
rotate.setByAngle(360); rotate.setByAngle(360);
rotate.setCycleCount(RotateTransition.INDEFINITE); rotate.setCycleCount(RotateTransition.INDEFINITE);
rotate.play(); rotate.play();
} }
public void login() throws IOException {
var loader = new FXMLLoader(getClass().getResource("/client/clientVue.fxml"));
loader.load();
Stage stage = (Stage) spinnerArc.getScene().getWindow();
stage.setScene(new Scene(loader.getRoot(), 800, 600));
centerStage(stage);
}
} }

View File

@@ -7,6 +7,6 @@
<StackPane xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml" <StackPane xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml"
fx:controller="client.ClientLoading" style="-fx-background-color: lightgrey;"> fx:controller="client.ClientLoading" style="-fx-background-color: lightgrey;">
<Arc fx:id="spinnerArc" centerX="50" centerY="50" radiusX="30" radiusY="30" <Arc fx:id="spinnerArc" centerX="50" centerY="50" radiusX="30" radiusY="30"
startAngle="30" length="330" fill="transparent" stroke="blue" strokeWidth="5" startAngle="30" length="330" fill="transparent" stroke="blue" strokeWidth="5" onMouseClicked="#login"
/> />
</StackPane> </StackPane>

View File

@@ -7,15 +7,39 @@
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.image.Image?>
<AnchorPane xmlns="http://javafx.com/javafx" <AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml" xmlns:fx="http://javafx.com/fxml"
fx:controller="client.ClientGuiController" fx:controller="client.ClientGuiController"
prefHeight="400.0" prefWidth="600.0"> prefHeight="400.0" prefWidth="600.0">
<HBox> <VBox>
<padding> <padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/> <Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/>
</padding> </padding>
<!-- Logo -->
<HBox alignment="CENTER">
<ImageView fitHeight="50.0" fitWidth="50.0">
<Image url="@/liscord.png" />
</ImageView>
<Label text="Liscord" style="-fx-font-size: 24px; -fx-font-weight: bold; -fx-padding: 0 0 0 10px"/>
</HBox> </HBox>
<!-- Client -->
<HBox>
<!-- Rooms -->
<ScrollPane>
<VBox fx:id="rooms" spacing="10.0">
<Label text="Rooms" style="-fx-font-size: 18px;"/>
<VBox fx:id="roomList" spacing="5.0"/>
</VBox>
</ScrollPane>
<!-- Chat -->
<ScrollPane>
<VBox fx:id="chat" spacing="10.0">
<Label text="Chat" style="-fx-font-size: 18px;"/>
<VBox fx:id="chatList" spacing="5.0"/>
</VBox>
</ScrollPane>
</HBox>
</VBox>
</AnchorPane> </AnchorPane>