Problema con JFrames activos

JoE
15 de Febrero del 2006
Saludos. Tengo un pequeño problema con las ventanas. En mi código tengo 2 JFrames, uno de ellos, el principal es un Canvas con keylistener y con mouselistener.
El otro JFrame simplemente tiene un textfield y un botón con un actionlistener. Cuando aprieto el botón quiero que este JFrame desaparezca y vuelva al otro, hasta aqui bien. El problema es que dejan de funcionarme tanto el mouselistener como el keylistener que tenia activos. :S

Tal vez con algo de código se entienda mejor...

********ESTE ES EL CODIGO DEL JFRAME PRINCIPAL**************
JFrame ventana =new JFrame();



JPanel panel = (JPanel)ventana.getContentPane();
setBounds(0,0,Stage.WIDTH,Stage.HEIGHT);
panel.setPreferredSize(new Dimension(Stage.WIDTH,Stage.HEIGHT));//
panel.setLayout(null); // Ens afegim al panel
panel.add(this); //

//}





ventana.setBounds(0,0,Stage.WIDTH,Stage.HEIGHT);

ventana.setVisible(true);
ventana.addWindowListener( new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);


}
});



ventana.setResizable(false);



createBufferStrategy(2); // Volem 2 buffers
strategy = getBufferStrategy(); // Assignem la sortida al buffer
requestFocus();

addKeyListener(this);
addMouseListener(this);



***********HASTA AQUI, Y ESTA SERIA LA FUNCION DEL JFRAME MOMENTANEO****************

if (f!=null){
f.setBounds(0,10,320,60);
JPanel p=new JPanel();
p.setLayout(new FlowLayout());
TextField tf=new TextField(\"Posa aqui la ip\");
p.add(tf);
Button b=new Button (\"Introdueix la IP del Servidor\");
p.add(b);
retornaIP r=new retornaIP(tf,this);
b.addActionListener(r);

ip=r.getText();

f.add(p);
f.setResizable(false);


f.setVisible(true);

}


La pregunta basicamente es, hay alguna funcion que me permita volver a la ventana que tenia activa anteriormente y que me funcionen los eventos de mouse y de teclado?

Gracias y sorry por el carraco :P