JAVA JFileChooser Window showing on last place -
don't know how ask /english isn't mother language :)/, i'm adding screenshot show this. when use jfilechooser, opens dialog window on last place /see screenshot/, not in front place - have click on last window, window, not showing first window = doesn't "pop up" after run program. enter image description here
it works fine, when use in main, when use in method, doing this.
import javax.swing.jdialog; import javax.swing.jfilechooser; public class jframechooser { public static void vybersuboru() { jfilechooser filechooser = new jfilechooser(); jdialog dialog = new jdialog(); int result = filechooser.showopendialog(dialog); if (result == jfilechooser.approve_option) { system.out.println(filechooser.getselectedfile().getabsolutepath()); } } }
you creating file chooser newly created dialog empty , not visible. instead use applications's main window parent.
something way:
public class jframechooser { public static void vybersuboru(jdialog parent) { jfilechooser filechooser = new jfilechooser(); int result = filechooser.showopendialog(parent); if (result == jfilechooser.approve_option) { system.out.println(filechooser.getselectedfile().getabsolutepath()); } } }
Comments
Post a Comment