java - Hide the path of the selected directory in JFileChooser -
i'm using jfilechooser select directories, set selection mode directories_only
, problem when select directory, absolute path displayed in text field in below picture:
is there way display name of directory, in file selection mode?
this code:
import javax.swing.jfilechooser; public class myform { public static void main(string[] args) { jfilechooser chooser = new jfilechooser(); chooser.setcurrentdirectory(new java.io.file("./")); chooser.setdialogtitle("select directory"); chooser.setfileselectionmode(jfilechooser.directories_only); chooser.setacceptallfilefilterused(false); if (chooser.showopendialog(null) == jfilechooser.approve_option) { system.out.println(chooser.getselectedfile().getabsolutepath()); } } }
Comments
Post a Comment