Skip to content

Commit bcba0a1

Browse files
committed
Added JavaDoc for RegisterController.java
1 parent b888eb5 commit bcba0a1

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/main/java/com/escapegame/RegisterController.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
import java.io.IOException;
44

55
import com.model.AuthenticationService;
6+
67
import javafx.fxml.FXML;
78
import javafx.scene.control.Label;
89
import javafx.scene.control.TextField;
910
import javafx.scene.input.MouseEvent;
1011

1112
/**
1213
* Controller for register.fxml
14+
* Handles user registration by validating form inputs and
15+
* calling {@link AuthenticationService#register(String, String, String, String, String)}.
16+
* Navigates to the login screen on success or shows an error message on failure.
1317
*/
1418
public class RegisterController {
1519

@@ -26,7 +30,14 @@ public class RegisterController {
2630
private Label lbl_error;
2731

2832
private final AuthenticationService authService = new AuthenticationService();
29-
33+
/**
34+
* Handles the Register button click event.
35+
* Validates that all required fields are filled, attempts to register
36+
* the user, and navigates to the login screen if successful. Displays
37+
* an error message otherwise.
38+
* @param event the mouse event triggered by the button click
39+
* @throws IOException if navigation to another scene fails
40+
*/
3041
@FXML
3142
private void btnRegisterClicked(MouseEvent event) throws IOException {
3243
String userId = txt_userId.getText();
@@ -58,7 +69,12 @@ private void btnRegisterClicked(MouseEvent event) throws IOException {
5869
lbl_error.setVisible(true);
5970
}
6071
}
61-
72+
/**
73+
* Handles the Back button click event.
74+
* Navigates back to the home screen.
75+
* @param event the mouse event triggered by the button click
76+
* @throws IOException if navigation fails
77+
*/
6278
@FXML
6379
private void back(MouseEvent event) throws IOException {
6480
App.setRoot("home");

0 commit comments

Comments
 (0)