Changing the text of a JLabel and status of JMenuItem during runtime?

I would recommend having a single variable to track whether the user is logged in or not and then bind your components appropriately.

I would recommend having a single variable to track whether the user is logged in or not and then bind your components appropriately private boolean loggedIn = false; public void disableMenues(){ mntmSupplierManagement. SetEnabled(!loggedIn); mntmEmployeeManagement. SetEnabled(!loggedIn); mntmStockManagement.

SetEnabled(!loggedIn); mntmReporting. SetEnabled(!loggedIn); mntmTransaction. SetEnabled(!loggedIn); userName.

SetText("Logged in as "+obj2. GetGlobalUsername()); } I would also suggest to track the LoginModel class throughout the session private LoginModel lm = null; private void authenticate(String username, String password){ //check username password (database maybe) //and return the LoginModel for the pair lm = returnedLoginModel; } And then in the JFrame all you have to do is if(lm! = null){ System.out.

Println("Logged into the system"); loggedIn = true; updateView(); else{ System.out. Println("Unsuccessful login"); loggedIn = false; updateView(); } Keep in mind that you have to track the logout as well private void logout(){ lm = null; }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions