Login.Java
package Login;
public class Login extends Application{
@Override
public void start(Stage stage)throws Exception{
Parent root = (Parent) FXMLLoader.load(getClass().getResource("Login.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.setTitle("Library Management System");
stage.show();}
public static void main(String[] args){
launch(args);} }
LoginController.java
package Login;
public class LoginController implements Initializable {
Librarian l1=new Librarian();
@FXML
private JFXTextField username;
@FXML
private JFXPasswordField password;
@FXML
private JFXButton Loginbutton;
@FXML
private JFXButton CancelButton;
@Override
public void initialize(URL url, ResourceBundle rb) {
}
@FXML
private void LibrarianLogin(ActionEvent event) throws SQLException {
if(l1.isLogin(username.getText(),password.getText())){
Stage stage = (Stage) this.Loginbutton.getScene().getWindow();
stage.close();
adminLogin();
}
}
@FXML
private void handleCancelBtnAction(ActionEvent event) {
}
public void adminLogin()
{
try{
Stage adminstage = new Stage();
FXMLLoader adminLoader = new FXMLLoader();
Pane adminroot = (Pane)adminLoader.load(getClass().getResource("/Librarian/admin.fxml").openStream());
AdminController adminController = (AdminController)adminLoader.getController();
Scene scene =new Scene(adminroot);
adminstage.setScene(scene);
adminstage.setTitle("Admin Dashboard");
adminstage.show();
}
catch (IOException e){
}
}
}
The error occurs when ever I press the login button! I don't know what to do!!! When I replace the admin.fxml with an empty fxml the other window appear when I click the login button!! I have no errors at all but these warnings:
Apr 21, 2018 1:38:07 AM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 9.0.1 by JavaFX
runtime of version 8.0.161
Apr 21, 2018 1:38:12 AM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 9.0.1 by JavaFX
runtime of version 8.0.161