I have had a problem concerning the JFileChooser for a long while now and haven't been able to find help... The problem is that the file window is not showing up. I have tried to find the cause of this problem and I have tested the following:
public class Test {
public static void main (String[] args) {
load();
}
public static void load () {
String folder = System.getProperty("user.dir");
JFileChooser fc = new JFileChooser(folder);
int resultat = fc.showOpenDialog(null);
}
}
When running this code I do get the window to show.
But, when I try this:
public class Test {
public static void main (String[] args) {
String input = JOptionPane.showInputDialog(null, "Make your choice!\n" +
"1. load file");
load();
}
}
the window is not showing however, the programming is still running... I have no clue what might be causing this problem
JFileChooser
doesn't show up until you press OK, Cancel or Exit in the input dialog - Then that's the expected behaviour. TheJOptionPane
creates a modal dialog that prevents the next line in the program from being called until the dialog closes. But if you don't mean that, I can't reproduce your problem. The program "works" for me :/ – Funderburk