Launching the client
The chat client can be launched in two ways:Using Gradle
Using Java directly
After building the project, run the main class: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:
Header
- Login label: Displays “Please Login” at the top of the screen
Login form
- Username field:
TextFieldwith prompt text “Username” - Password field:
PasswordFieldwith 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:
VBoxwith 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
Choose authentication method
Click one of the available buttons:
- Sign In: Authenticate with existing credentials
- Sign Up Instead: Create a new account
Application architecture
The client follows the JavaFXApplication lifecycle:
Entry point flow
Start method
TheFXApplication.start() method (line 48-54):
- Creates the login screen VBox
- Initializes a Scene with 640x480 dimensions
- Sets the scene on the primary stage
- Shows the stage to display the window
UI customization
The login screen uses the following JavaFX styling properties:- Alignment:
Pos.CENTERfor 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.