Não sei como chamar uma tela feita e coloca-la na tela apartir de om botão que esta em uma tela que não seja a principal!!
public class Principal extends JFrame implements ActionListener {
TelaCadastro pCadastro = new TelaCadastro();
Botoes bt = new Botoes();
JPanel pBase;
JPanel pGerente;
public Principal() {
getContentPane().setLayout(new BorderLayout());
pPrincipal.setLayout(new FlowLayout());
pCadastro.setLayout(new FlowLayout(0, 5, 15));
pGerente.add(pPrincipal,"principal");
pBase.add(bt.Cadastrar);
pBase.add(bt.Buscar);
getContentPane().add("Center",pGerente);
getContentPane().add("South",pBase);
}
public void actionPerformed(ActionEvent e) {
pGerente.add(pCadastro,"cadastro");
CardLayout tela = (CardLayout) pGerente.getLayout();
if (e.getSource() == bt.Cadastrar) {
tela.show(pGerente,"cadastro");
}
public class TelaCadastro extends JPanel implements ActionListener{
TelaConfirmacao pConfirmacao = new TelaConfirmacao()
Botoes bt = new Botoes();
public TelaCadastro(){
add(bt.Confirmar);
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == bt.Confirmar) {
if(cliente.cadastrar()){
???? Como mandar aparecer na tela principal o pConfirmação ???
???Qual o comando????? Como chamar???
}
}