Skip to content

Commit 63c8113

Browse files
committed
Added JavaDoc for HomeController.java
1 parent 78096bb commit 63c8113

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

src/main/java/com/escapegame/HomeController.java

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
11
package com.escapegame;
22

33
import java.io.IOException;
4+
45
import javafx.fxml.FXML;
5-
import javafx.scene.control.Button;
66
import javafx.scene.control.Alert;
7+
import javafx.scene.control.Button;
78

89
/**
910
* Home screen controller — wired to home.fxml
11+
* This controller manages the application's home screen,
12+
* handling navigation to the login and register views.
1013
*/
1114
public class HomeController {
1215

16+
/** Button that navigates to the login screen. */
1317
@FXML private Button loginButton;
18+
/** Button that navigates to the registration screen */
1419
@FXML private Button registerButton;
15-
20+
21+
/**
22+
* Initializes the home controller
23+
* Called automatically after FMXL loading.
24+
*/
1625
@FXML
1726
private void initialize() {
1827
System.out.println("HomeController initialized");
1928
}
20-
29+
/**
30+
* Handles the login button click
31+
* Navigates to the login view.
32+
*/
2133
@FXML
2234
private void onLogin() {
2335
System.out.println("Login button clicked");
@@ -28,7 +40,10 @@ private void onLogin() {
2840
showError("Unable to open login screen:\n" + e.getMessage());
2941
}
3042
}
31-
43+
/**
44+
* Handles the register button click
45+
* Navigates to the registration view.
46+
*/
3247
@FXML
3348
private void onRegister() {
3449
System.out.println("Register button clicked");
@@ -40,7 +55,10 @@ private void onRegister() {
4055
}
4156
}
4257

43-
58+
/**
59+
* Displays an error alert dialog if navigation fails
60+
* @param message the error message to display
61+
*/
4462
private void showError(String message) {
4563
Alert a = new Alert(Alert.AlertType.ERROR);
4664
a.setHeaderText("Navigation error");

0 commit comments

Comments
 (0)