I need to select or read only .config files via file chooser in java fx can any one help me

108 views Asked by At

I need to get the file path of the .config folder only can any one help me

1

There are 1 answers

0
Ashish On BEST ANSWER

You can add ExtensionFilter to your FileChooser to select only .config files (or any type) via FileChooser. e.g.

FileChooser flc = new FileChooser();
flc.setTitle("Select File");
ExtensionFilter ext = new ExtensionFilter("Config Files", "*.config");
flc.getExtensionFilters().add(ext);

File tmpFile = flc.showOpenDialog(stage);

You can set any extention type to the FileChooser. e.g.

ExtensionFilter ext = new ExtensionFilter("Image Files", "*.png", "*.jpg", "*.jpeg");

Hope it helps.!