My tool replaces the text of the files (their name and / or content). Actually, for these purposes, I need to be able to choose the name of the file and the folder (in order to apply the refactoring capabilities to its attached files). Delving into the Internet, I found nothing worthwhile. There are two implementations mentioned in the title. Can anyone come across this problem and be able to help? Here are pieces of code that demonstrate these two dialogs.

private void defineFilePathWithDirectoryChooser(){ DirectoryChooser chooser = new DirectoryChooser(); chooser.setTitle("Define Root File"); File defaultDirectory = new File("ur directory"); chooser.setInitialDirectory(defaultDirectory); File selectedDirectory = chooser.showDialog(stage); if (selectedDirectory != null) { this.filePath = selectedDirectory.toString(); filepathfld.setText(this.filePath); } } private void defineFilePathWithFileChooser() { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Define Root File"); File selectedFile = fileChooser.showOpenDialog(stage); if (selectedFile != null) { this.filePath = selectedFile.toString(); filepathfld.setText(this.filePath); } } 

    1 answer 1

    Apparently you have to write your custom component, because judging by this ishvyu, not all platforms can simultaneously support the selection of a directory and files, so this will not be in javafx