Merge 'feat/lobby-ui' back into 'main' #172
@@ -3,8 +3,25 @@ package ch.unibas.dmi.dbis.cs108.casono;
|
|||||||
import ch.unibas.dmi.dbis.cs108.casono.client.ClientApp;
|
import ch.unibas.dmi.dbis.cs108.casono.client.ClientApp;
|
||||||
import ch.unibas.dmi.dbis.cs108.casono.server.ServerApp;
|
import ch.unibas.dmi.dbis.cs108.casono.server.ServerApp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main entry point for Casono application.
|
||||||
|
* Handles client and server startup.
|
||||||
|
* <p>
|
||||||
|
* Standardkonstruktor für die Anwendung.
|
||||||
|
*/
|
||||||
public final class Main {
|
public final class Main {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standardkonstruktor.
|
||||||
|
*/
|
||||||
|
public Main() {
|
||||||
|
// Standardkonstruktor
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main entry point for Casono.
|
||||||
|
* @param args Command line arguments
|
||||||
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
if (!isValid(args)) {
|
if (!isValid(args)) {
|
||||||
printUsage();
|
printUsage();
|
||||||
|
|||||||
@@ -1,6 +1,29 @@
|
|||||||
package ch.unibas.dmi.dbis.cs108.casono.client;
|
package ch.unibas.dmi.dbis.cs108.casono.client;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entry point for the Casono client application.
|
||||||
|
* Handles client startup and connection parameters.
|
||||||
|
*/
|
||||||
import ch.unibas.dmi.dbis.cs108.casono.client.ui.Launcher;
|
import ch.unibas.dmi.dbis.cs108.casono.client.ui.Launcher;
|
||||||
|
/**
|
||||||
|
* Entry point for the Casono client application.
|
||||||
|
* Handles client startup and connection parameters.
|
||||||
|
* <p>
|
||||||
|
* Standardkonstruktor für die Anwendung.
|
||||||
|
*/
|
||||||
public class ClientApp {
|
public class ClientApp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standardkonstruktor.
|
||||||
|
*/
|
||||||
|
public ClientApp() {
|
||||||
|
// Standardkonstruktor
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Starts the client application with the given address.
|
||||||
|
* @param arg Address in the format "ip:port".
|
||||||
|
* @throws IllegalArgumentException if the address format is invalid.
|
||||||
|
*/
|
||||||
public static void start(String arg) {
|
public static void start(String arg) {
|
||||||
String[] parts = arg.split(":", 2);
|
String[] parts = arg.split(":", 2);
|
||||||
if (parts.length != 2) {
|
if (parts.length != 2) {
|
||||||
|
|||||||
@@ -2,7 +2,23 @@ package ch.unibas.dmi.dbis.cs108.casono.client.ui;
|
|||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launcher for the Casono main UI.
|
||||||
|
* <p>
|
||||||
|
* Standardkonstruktor für die Anwendung.
|
||||||
|
*/
|
||||||
public class Launcher {
|
public class Launcher {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standardkonstruktor.
|
||||||
|
*/
|
||||||
|
public Launcher() {
|
||||||
|
// Standardkonstruktor
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Main entry point for launching the UI.
|
||||||
|
* @param args Command line arguments
|
||||||
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Application.launch(ch.unibas.dmi.dbis.cs108.casono.client.ui.lobbyui.Casinomainui.class, args);
|
Application.launch(ch.unibas.dmi.dbis.cs108.casono.client.ui.lobbyui.Casinomainui.class, args);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package ch.unibas.dmi.dbis.cs108.casono.client.ui.lobbyui;
|
package ch.unibas.dmi.dbis.cs108.casono.client.ui.lobbyui;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main UI application for Casono.
|
||||||
|
* Loads the main FXML layout and sets up the stage.
|
||||||
|
*/
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
@@ -7,8 +11,25 @@ import javafx.stage.Stage;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JavaFX Application class for the Casono main UI.
|
||||||
|
* <p>
|
||||||
|
* Standardkonstruktor für die Anwendung.
|
||||||
|
*/
|
||||||
public class Casinomainui extends Application {
|
public class Casinomainui extends Application {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standardkonstruktor.
|
||||||
|
*/
|
||||||
|
public Casinomainui() {
|
||||||
|
// Standardkonstruktor
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
|
/**
|
||||||
|
* Starts the JavaFX application and loads the main UI.
|
||||||
|
* @param stage The primary stage for this application.
|
||||||
|
* @throws IOException If loading the FXML fails.
|
||||||
|
*/
|
||||||
public void start(Stage stage) throws IOException {
|
public void start(Stage stage) throws IOException {
|
||||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/ui-structure/Casinomainui.fxml"));
|
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/ui-structure/Casinomainui.fxml"));
|
||||||
Scene scene = new Scene(fxmlLoader.load(), 1200, 800);
|
Scene scene = new Scene(fxmlLoader.load(), 1200, 800);
|
||||||
@@ -20,6 +41,10 @@ public class Casinomainui extends Application {
|
|||||||
stage.show();
|
stage.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main entry point for launching the application.
|
||||||
|
* @param args Command line arguments
|
||||||
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
launch();
|
launch();
|
||||||
}
|
}
|
||||||
|
|||||||
+30
@@ -1,4 +1,9 @@
|
|||||||
package ch.unibas.dmi.dbis.cs108.casono.client.ui.lobbyui;
|
package ch.unibas.dmi.dbis.cs108.casono.client.ui.lobbyui;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller for the Casono main UI lobby.
|
||||||
|
* Handles UI initialization and user actions.
|
||||||
|
*/
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
@@ -16,23 +21,45 @@ import javafx.scene.input.MouseEvent;
|
|||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller for the Casono main UI lobby.
|
||||||
|
* Handles UI initialization and user actions.
|
||||||
|
* <p>
|
||||||
|
* Standardkonstruktor für den Controller.
|
||||||
|
*/
|
||||||
public class CasinomainuiController {
|
public class CasinomainuiController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standardkonstruktor.
|
||||||
|
*/
|
||||||
|
public CasinomainuiController() {
|
||||||
|
// Standardkonstruktor
|
||||||
|
}
|
||||||
|
/** Root pane of the UI. */
|
||||||
@FXML
|
@FXML
|
||||||
private AnchorPane rootPane;
|
private AnchorPane rootPane;
|
||||||
|
/** Title label for the main UI. */
|
||||||
@FXML
|
@FXML
|
||||||
private Label titleLabel;
|
private Label titleLabel;
|
||||||
|
/** Subtitle label for the main UI. */
|
||||||
@FXML
|
@FXML
|
||||||
private Label subtitleLabel;
|
private Label subtitleLabel;
|
||||||
|
/** Logo image view. */
|
||||||
@FXML
|
@FXML
|
||||||
private javafx.scene.image.ImageView logoView;
|
private javafx.scene.image.ImageView logoView;
|
||||||
|
/** Green box shape element. */
|
||||||
@FXML
|
@FXML
|
||||||
private javafx.scene.shape.Rectangle greenBox;
|
private javafx.scene.shape.Rectangle greenBox;
|
||||||
|
/** Exit button for closing the application. */
|
||||||
@FXML
|
@FXML
|
||||||
private Button exitbutton;
|
private Button exitbutton;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the UI components and sets default values.
|
||||||
|
*/
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
titleLabel.setText("Casono");
|
titleLabel.setText("Casono");
|
||||||
subtitleLabel.setText("Texas Hold'em Poker");
|
subtitleLabel.setText("Texas Hold'em Poker");
|
||||||
@@ -40,6 +67,9 @@ public class CasinomainuiController {
|
|||||||
logoView.setImage(new javafx.scene.image.Image(getClass().getResource("/images/logo.png").toExternalForm()));
|
logoView.setImage(new javafx.scene.image.Image(getClass().getResource("/images/logo.png").toExternalForm()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the exit button action to close the application.
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
public void handleexitbutton() {
|
public void handleexitbutton() {
|
||||||
Platform.exit();
|
Platform.exit();
|
||||||
|
|||||||
Reference in New Issue
Block a user