I'm trying to set a logon frame using Java Swing - Eclipse.
I can't find how to redirect the user to another frame on success of the operation.
Any brilliant idea, please?
I'm trying to set a logon frame using Java Swing - Eclipse.
I can't find how to redirect the user to another frame on success of the operation.
Any brilliant idea, please?
create a SessionClass
put a final field in the class ( better create some long and complex no taking user id as input and use as session id )
when instantiated , pass the user id as the value of the final field
instantiate the class with user id , when logging in and keep passing this session object in every frame
create a login panel class and another panel that will be used after redirection ,and a
frame class when you want to do redirection remove the login panel from the frame and add the panel that contains your User Interface.
LoginPanel extends JPanel{
public LoginPanel(JFrame frame) {
createLoginPanel();
}
public void verifyConnexion(JFrame frame) {
if(isTrueRedirect()){
frame.getContentPane().removeAll();
frame.getContentPane().add(new redirectedPanel());
frame.pack();
}
}
}
public class MyFrame extends JFrame {
public MyFrame(){
Container contenu = getContentPane();
contenu.add(new LoginPanel(this));
}
}