How to open the previous panel in two different GUIs?

0

The problem is as follows, my program consists of a kind of A2 that is separated in a top panel (where I have customized closed buttons), a lower panel (where the icons of the different A2 modules go) and a large central panel where it shows the module as such. At the beginning it requires a login with user and account, by clicking on Register (in case it is a nonexistent account) it hides the central panel that would be the start menu and opens a new panel that is the registry, said panel (the record) is a different class thought to separate each module in a different class and then only instantiate them if necessary.

This part is in the main class where the login menu is loaded.

private void registrarActionPerformed(java.awt.event.ActionEvent evt) {                                          
    // TODO add your handling code here:
        backBut.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bdd/a2/ImgResources/if_logout_account_exit_door_3005766.png")));
        rp = new RegisterPanel();
        rp.setBounds(PanelCentral.getX(), PanelCentral.getY(), PanelCentral.getWidth(), PanelCentral.getHeight());
        backBut.setEnabled(true);
        Contenedor.add(rp);   
        rp.setVisible(true);
}      

And it is at the end of the registration

private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {                                          
    // TODO add your handling code here:       
    if(namebool && cedbool && emailbool && psw1bool && psw2bool){
        Conexion con = new Conexion();
        String pass = contraseña1.getText();
        int random = (int) (Math.random() * ((100 - 1) + 1)) + 1;
        String salt = Security.getSalt(random);
        String encryptedPass = Security.generateSecurePassword(pass, salt);
        //int oS = con.AddUser(name.getText(), cedula.getText(), encryptedPass, salt, email.getText());
        int oS = 1;
        if(oS == 1){
            //Regresar al panel anterior
        }else{
            JOptionPane.showConfirmDialog(null, "Por favor Verifique todos los Campos.");
        }  
    }
} 

The problem is to be able to open again the Central panel of the Main Menu and hide the Registration panel.

    
asked by Luis Consuegra 17.11.2018 в 09:38
source

0 answers