I am creating a staff management system and i would like to know how i can pass the details of the staff from the login frame to other frames when they successfully login.
My current method is to retrieve their data when the successfully login and pass it through the constructor.
if(checkPassword.equals(password)&&checkStaffId.equals(staffId)){
close();
String name = temp.getName();
String position = temp.getPosition();
String imageSrc = temp.getImageSRC();
String email = temp.getEmail();
Home page = new Home(staffId,name,position,imageSrc,email);
page.setVisible(true);
MainInterface menu = new MainInterface(staffId,name,position,imageSrc,email);
form b = new form(staffId,name,position,imageSrc,email);
Patients a = new Patients(staffId,name,position,imageSrc,email);
AdminMenu admin = new AdminMenu(staffId,name,position,imageSrc,email);
MainRpt r = new MainRpt(staffId,name,position,imageSrc,email);
viewSchedule s = new viewSchedule(staffId,name,position,imageSrc,email);
}
It works but I would like to know if there is other ways of doing it.