-2

Error I have this problem i don't know what is wrong Project Structure is this. and the code :

public void logInAction(ActionEvent actionEvent) throws Exception {
    try {
        FXMLLoader mainLoader = new FXMLLoader();
        mainLoader.setLocation(getClass().getResource("/controller/manage.fxml"));
        Parent root = mainLoader.load();
        MainController mainController = mainLoader.getController();
        service.logInUser(emailField1.getText(),passwordField1.getText());
        loggedInUser = service.getLoggedInUser();
        Stage main_stage = new Stage();
        mainController.init(service,loggedInUser);
        main_stage.setScene(new Scene(root));
        main_stage.show();

        Stage stage = (Stage) loginButton.getScene().getWindow();
        stage.close();
    } catch (Exception exception) {
        errorLabel1.setText(exception.getMessage());
        System.out.println(exception.getMessage());
    }
}
jewelsea
  • 141,332
  • 12
  • 351
  • 391
yay19
  • 1
  • 1
  • 3
    [mcve] please .. and no screenshots of plain text, and stick to java naming conventions btw: the error looks unrelated to fx – kleopatra May 28 '22 at 09:37
  • the problem appear when i am on the line with load(),that info with red isn't the problem – yay19 May 28 '22 at 09:50
  • 4
    Please [edit] your question to add the stack trace of the error—as text, not an image, preferably formatted as code. – Slaw May 28 '22 at 10:31
  • 4
    Don't just log the exception message, [log the entire stack trace](https://stackoverflow.com/questions/2560368/what-is-the-use-of-printstacktrace-method-in-java). The message often does not tell you the cause of the error, nor where the error occurred, but the stack trace usually tells you both of those things. – jewelsea May 28 '22 at 11:17
  • 3
    That image that your provide linked as `Error` is irrelevant and useless for diagnostic purposes. You note "that info with red isn't the problem". However, "that info in red" is the only info in the image. To get help with your issue you should supply the requested minimal example. For example, no database code, no unnecessary code unrelated to the issue, but do provide all code required to reproduce the issue via copy and paste (including fxml). – jewelsea May 28 '22 at 11:21
  • While preparing your [mre], shouldn't the FXML path be `"controller/css/manage.fxml"`? Also, check its `fx:controller` attribute. – trashgod May 28 '22 at 12:31
  • please read the referenced help page and act accordingly – kleopatra May 28 '22 at 14:50

0 Answers0