Pessoal tenho um FrameView que é o form principal da aplicação dentro do FrameView eu tenho um mainPainel
private javax.swing.JPanel mainPanel;
eu criei outro painel para fazer um cadastro
public class TelaCadastroUsuario extends javax.swing.JPanel{
public TelaCadastroUsuario() {
initComponents();
setBounds(600, 400, 200,200);
try {
List<Usuario> lista = new UsuarioProcess().findAll();
UsuarioTabela tabela = new UsuarioTabela(lista);
tblUsuario.setModel(tabela);
} catch (RepositoryException ex) {
Logger.getLogger(TelaCadastroUsuario.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
no FrameView tenho um menu e no seguinte método
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JFrame mainFrame = ControlePermissaoApp.getApplication().getMainFrame();
mainPanel = new TelaCadastroUsuario();
mainFrame.setContentPane(mainPanel);
mainFrame.setVisible(true);
//mainFrame.pack();
}
mainPainel.setVisible(true);
mainPainel.repaint();
mais nenhum deu certo, como eu poderia fazer isso.