styling and transition with login page

This commit is contained in:
Clément
2025-03-05 18:38:54 +01:00
parent 5cefe42a99
commit f87145ed69
4 changed files with 27 additions and 25 deletions

View File

@@ -3,9 +3,7 @@ package client;
import javafx.application.Application; import javafx.application.Application;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.layout.StackPane;
import javafx.stage.Screen; import javafx.stage.Screen;
import javafx.stage.Stage; import javafx.stage.Stage;

View File

@@ -16,6 +16,9 @@ public class ClientLogin {
@FXML @FXML
private void login() throws IOException { private void login() throws IOException {
if(usernameField.getText().isEmpty()) {
return;
}
var loader = new FXMLLoader(getClass().getResource("/client/clientLoading.fxml")); var loader = new FXMLLoader(getClass().getResource("/client/clientLoading.fxml"));
loader.load(); loader.load();
Stage stage = (Stage) usernameField.getScene().getWindow(); Stage stage = (Stage) usernameField.getScene().getWindow();

View File

@@ -7,27 +7,17 @@
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<GridPane xmlns="http://javafx.com/javafx"
<VBox alignment="CENTER" spacing="10.0"
xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml" xmlns:fx="http://javafx.com/fxml"
fx:controller="client.ClientLogin" fx:controller="client.ClientLogin"
prefHeight="400.0" prefWidth="600.0"> prefHeight="400.0" prefWidth="600.0"
styleClass="login-box">
<VBox spacing="10.0" GridPane.columnIndex="1" GridPane.rowIndex="1"> <padding>
<Insets bottom="10.0" left="100.0" right="100.0" top="10.0"/>
</padding>
<Label text="Enter your username"/> <Label text="Enter your username"/>
<TextField fx:id="usernameField"/> <TextField fx:id="usernameField" onAction="#login" styleClass="login"/>
<Button text="Login" onAction="#login"/> <Button text="Login" onAction="#login"/>
</VBox> </VBox>
<columnConstraints>
<ColumnConstraints hgrow="ALWAYS"/>
<ColumnConstraints halignment="CENTER"/>
<ColumnConstraints hgrow="ALWAYS"/>
</columnConstraints>
<rowConstraints>
<RowConstraints vgrow="ALWAYS"/>
<RowConstraints valignment="CENTER"/>
<RowConstraints vgrow="ALWAYS"/>
</rowConstraints>
</GridPane>

View File

@@ -0,0 +1,11 @@
.login-box {
-fx-background-color: lightgray;
}
.login {
-fx-border-color: transparent;
}
.login:focused {
-fx-border-color: lightgrey;
}