Skip to main content

Launching the client

The chat client can be launched in two ways:

Using Gradle

./gradlew run

Using Java directly

After building the project, run the main class:
java -cp build/classes/java/main org.uwgb.compsci330.frontend.Main
The Main class serves as a wrapper that calls FXApplication.main() to avoid runtime dependency issues with JavaFX module loading.

Login screen walkthrough

When the application launches, you’ll see the login screen with the following components:

UI components

The login screen (FXApplication.createLoginScreen()) consists of:
  • Login label: Displays “Please Login” at the top of the screen

Login form

  • Username field: TextField with prompt text “Username”
  • Password field: PasswordField with prompt text “Password”
  • Sign In button: Primary action to authenticate
  • Sign Up Instead button: Alternative action to create a new account

Layout specifications

The login screen uses JavaFX layout containers:
  • Root container: VBox with center alignment and 20px padding on all sides
  • Form spacing: 20px between form elements
  • Button width: Minimum 100px width for both action buttons
  • Window size: 640x480 pixels
The UI is built programmatically using JavaFX controls, not FXML, despite the FXML module being available in the dependencies.

Connecting to the server

1

Enter credentials

Type your username in the username field and password in the password field.
The password field uses PasswordField component which masks input for security.
2

Choose authentication method

Click one of the available buttons:
  • Sign In: Authenticate with existing credentials
  • Sign Up Instead: Create a new account
3

Establish connection

Once authenticated, the client will establish a connection to the chat server.

Application architecture

The client follows the JavaFX Application lifecycle:

Entry point flow

Main.main()
  └─> FXApplication.main()
       └─> Application.launch()
            └─> FXApplication.start(Stage)
                 └─> createLoginScreen()

Start method

The FXApplication.start() method (line 48-54):
  1. Creates the login screen VBox
  2. Initializes a Scene with 640x480 dimensions
  3. Sets the scene on the primary stage
  4. Shows the stage to display the window

UI customization

The login screen uses the following JavaFX styling properties:
  • Alignment: Pos.CENTER for centered content
  • Spacing: 20px between elements
  • Padding: Insets(20, 20, 20, 20) for uniform padding
  • Control sizing: Buttons use setMinWidth() for consistent appearance
All UI components are defined in FXApplication.java:15-46. The layout uses nested VBox containers for vertical stacking of elements.

Build docs developers (and LLMs) love