I am developing an application in which I call several JInternalFrame from a menu. These JInternalFrames open a JDialog in turn.
The problem arises when I open for second, third and so on said frames, because when calling the dialogs, they open as many times as previously opened the frame. That is to say, if I open it for the first time, when calling the dialog it is normally displayed. If I open it a second time, the JInternalFrame runs normally, but the dialog opens twice, then three times, and so on.
The code I use to call the JInternalFrame is the following:
public void abrir_vtClientes(){
vtCliente v = new vtCliente();
boolean mostrar=true;
for (int a=0;a<dsk.getComponentCount();a++){ // verificar si es instancia de algun componente que ya este en el jdesktoppane
if( v.getClass().isInstance( dsk.getComponent(a) )){
mostrar=false;
}
}
if(mostrar){
vtCliente.rbAlumnos.setSelected(true);
dsk.add(v);
v.setSize(800,600);
}
v.show();
}
And the call to jdialog is this:
dlgCliente.setSize(900,400);
dlgCliente.setModal(true);
dlgCliente.setVisible(true);
Thanks in advance for the help given