Fechar JFrame

2 respostas
G

Oi pessoal,

é o seguinte, tenho minha JFrame principal e tenho um botao e abro uma outra JFrame da seguinte forma:

private void mnuItemKundenMouseClicked(java.awt.event.MouseEvent evt) {
        GuiKunde neuGuiKunde = new GuiKunde();
        neuGuiKunde.setVisible(true);
    }

ai quando fecho essa JFrame, a JFrame princiapl fecha junto!

O que estou fazendo errado? :?

2 Respostas

ViniGodoy
neuGuiKunde.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

Deve estar como EXIT_ON_CLOSE. E nesse caso é sair da aplicação, não do Frame.

Tchüss.

G

EXATAMENTE ISSO Vini!

Obrigado

Ficou assim:

GuiKunde neuGuiKunde = new GuiKunde();
        neuGuiKunde.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        neuGuiKunde.setVisible(true);
Criado 28 de maio de 2010
Ultima resposta 28 de mai. de 2010
Respostas 2
Participantes 2