I'm using Eclipse as my IDE
i already have the code for login -check if user and pass match -check if account's session column in DB is "logged in". if false log in user, else prompt the user
when logging out, i have a log out button which when clicked changes the 'logged in' into 'logged out'. Now the problem is when the user didnt click the log out button and instead just closes the application. I tried making a window listener when the frame is 'closing' then redirecting that to the log out button, it kinda solves my problem so I assigned every frame to redirect to the log out button action when 'window is closing'.
My app works like this: My app has multiple frames. After logging in there is the homepage, then 4 more buttons to direct you to other modules. In Homepage, when you click on module_A, homepage then disposes and module_A frame pops up, if you click the 'back' button module_A disposes and homepage pop ups again, clicking module_b disposes homepage and pops up module_b frame and so on...
Scenerio 1:
~logged in - changes user status from 'logged out' to 'logged in' redirects user from log in page to home page
~on homepage i forgot what i would do so i just close the application, since i have a listener 'window closing' that will change 'logged in' state to 'logged out' it's good.
Scenerio 2:
~logged in - changes user status from 'logged out' to 'logged in' redirects user from log in page to home page
~on homepage i click on module_A, that will then dispose the homepage AND will change 'logged in' status into 'logged out' because homepage window closed.
how can i fix scenerio 2? since closing a frame logs me out but im still using the app only with a different frame called moduleA
PS. if you guys dont understand what im saying, please ask questions, ill answer as fast as i can. im not really good at explaining my situation im so sorry :'(