I'll summarize and sorry for my English.
I have a client and a server thread, when touching a button send file is correctly displayed the JFileChooser with showOpenDialog, when want to create a second JFileChooser in the server thread when a file is received, only a blank screen comes out.
I already created the code in a class, in a function, in a new JFrame, and in the same function.
From what I saw, the problem arises when creating the second JFileChooser, since if in the first one I change it by showSaveDialog it shows well.
Code:
class GuardarArchivo extends javax.swing.JFrame {
JFrame jf = new JFrame();
jf.setAlwaysOnTop(true);
JFileChooser elegirRuta = new JFileChooser();
elegirRuta.setDialogTitle("Selecciona donde guardar el archivo: ");
int returnVal = elegirRuta.showSaveDialog(jf);
System.out.print(returnVal);
ruta = elegirRuta.getSelectedFile().getAbsolutePath();
}
Image: