Multiple Screens in a single Swing application
843806Feb 10 2009 — edited Feb 11 2009I am trying to make my swing client as follows :
Initially there is a 'login' screen on the client. When the user fills up the username and password and clicks login, a method is called that authenticates the user.
If login is successful then a new screen (called 'home' screen) opens up in the same window.
I am trying to do this by having a single JFrame window and multiple JPanel windows. I add or remove a JPanel window according to the state of the application. For example when the state is say 'login' then i add the Login JPanel , when the screen is 'home', i remove the Login JPanel and add the 'home' JPanel. I am thinking of creating a JPanel for each of such screens.
This, however is not having desired effect. First i dont know how to do this using NetBeans' Swing Designer.
If I create a new JPanel inherited class for each of my screens, then i dont know how to pass messages from the JPanel to the parent JFrame. For instance how do i communicate from the 'login' JPanel to the parent Jframe that login has been successful and change the screen.
Please guide as to how to get this effect and whether my approach is correct