Quando eu clico em ARQUIVO/CAD1 ele abre a tela CAD1 mais depois que eu fecho e tento abrir novamente a tela nao aparece alguem sabe pq ?
Desde ja muito grato 
package main;
import javax.swing.*;
import java.awt.event.*;
import main.cCAD1;
/**
-
@author Administrador
-
To change the template for this generated type comment go to
-
Window>Preferences>Java>Code Generation>Code and Comments
*/
public class cPRINCIPAL extends JFrame {public cPRINCIPAL () {
JMenuBar bar = new JMenuBar(); JMenu mnARQUIVO = new JMenu("Arquivo"); JMenuItem miCAD1 = new JMenuItem("Cad1"); JMenuItem miCAD2 = new JMenuItem("Cad2"); JMenuItem miSAIR = new JMenuItem("Sair"); mnARQUIVO.add(miCAD1); mnARQUIVO.add(miCAD2); mnARQUIVO.addSeparator(); mnARQUIVO.add(miSAIR); bar.add(mnARQUIVO); setJMenuBar( bar ); miCAD1.addActionListener(new ActionListener() { public void actionPerformed( ActionEvent event) { new cCAD1( ); getContentPane().add( cCAD1.pnCAD1 ); } }); //setState(); setVisible( true );
}
public static void main(String[] args) {
cPRINCIPAL application = new cPRINCIPAL();application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
}
}
import java.awt.Container;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
/**
-
@author Administrador
-
To change the template for this generated type comment go to
-
Window>Preferences>Java>Code Generation>Code and Comments
*/
public class cCAD1 {public static JDesktopPane pnCAD1;
public static JInternalFrame frame;public cCAD1 () {
pnCAD1 = new JDesktopPane(); frame = new JInternalFrame("Cadastro 1", true, true, true, true ); Container container = frame.getContentPane(); frame.pack(); frame.setVisible( true ); pnCAD1.add( frame );
}
}