It works !

This commit is contained in:
Clément
2025-03-12 14:26:13 +01:00
parent 3eec95e420
commit 2be11ec4a8
5 changed files with 64 additions and 60 deletions

View File

@@ -5,9 +5,7 @@ import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import client.ClientGui;
import java.io.IOException;
import java.net.InetSocketAddress;
import static utilities.FxUtilities.centerStage;
@@ -21,10 +19,9 @@ public class ClientLogin {
if(username.isEmpty()) {
return;
}
UsernameSingleton.getInstance().setUsername(username);
var loader = new FXMLLoader(getClass().getResource("/client/clientLoading.fxml"));
Client client = new Client(new InetSocketAddress("localhost", 6665), loader.getController(), username);
loader.load();
((ClientLoading) loader.getController()).setClient(client);
Stage stage = (Stage) usernameField.getScene().getWindow();
stage.setScene(new Scene(loader.getRoot(), 800, 600));
centerStage(stage);