Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

javafx open file dialog

FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Import new data");
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("CSV Files", "*.csv"));
fileChooser.setInitialDirectory(new File("."));
File file = fileChooser.showOpenDialog(window);

if (file != null) {
  // do things
} else {
  // no file got selected
}
Source by jenkov.com #
 
PREVIOUS NEXT
Tagged: #javafx #open #file #dialog
ADD COMMENT
Topic
Name
8+4 =