How can I call a JPanel with a menuitem

0

I have a Jframe (MainWindows) where there is a menuItem (Inventory) with which I want to call a JPanel and that it is displayed on the screen.

I'm using this code but it does not show anything or give an error:

 if(prd != null)
 {
 PanelListaProductosAlmacen pvc = new PanelListaProductosAlmacen(prd);
 this.getContentPane().add(pvc);
 this.pvc.setVisible(true);

 JLabel aviso = new JLabel("");
 aviso.setVisible(false);
 JOptionPane.showInternalOptionDialog(this, pvc, "Registro de 
 Ingresos",JOptionPane.OK_CANCEL_OPTION,
 JOptionPane.QUESTION_MESSAGE, null, new Object[]{aviso},null);

 } 

If I remove the if it gives me several errors

    
asked by Yan Carlos 12.04.2018 в 19:32
source

0 answers