public class main_gui_class extends Application {
@Override
public void start(Stage stage) throws IOException {
log_in_scene(stage);
}
public void log_in_scene(Stage stage) throws IOException{
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("log_in_page.fxml"));
Parent root = fxmlLoader.load();
Scene scene = new Scene(root);
stage.setTitle("Hello!");
stage.setScene(scene);
stage.show();
}
public void home_page_scene(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("home_page.fxml"));
Parent root = fxmlLoader.load();
Scene scene = new Scene(root);
stage.setTitle("Hello!");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
}
public class login_controller {
@FXML
private TextField username;
@FXML
private TextField password;
private Stage stage;
String user = "admin";
String pass = "admin1";
@FXML
protected void loginClicked(ActionEvent event) throws IOException {
if (username.getText().equals(user) && password.getText().equals(pass)){
// Call it from here
System.out.println("SUCCESS");
}else {
System.out.println("INVALID PASSWORD");
}
}
}
I want to call the home_page_scene from the login controller