Skip to content

Commit

Permalink
Show textArea only as content after the user successfully opens a file
Browse files Browse the repository at this point in the history
  • Loading branch information
besidev committed Oct 23, 2023
1 parent 60ff172 commit 1b87d73
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ public Parent createRoot(Stage stage) {
Button openButton = new Button("Open", new FontIcon(Material2AL.FOLDER_OPEN));
openButton.setDefaultButton(true);
FileOpenPicker fileOpenPicker = FileOpenPicker.create(openButton);
fileOpenPicker.getExtensionFilters().add(textExtensionFilter);
fileOpenPicker.setSelectedExtensionFilter(textExtensionFilter);
fileOpenPicker.setOnFilesSelected(fileSources -> openFile(fileSources, textArea));
fileOpenPicker.setOnFilesSelected(fileSources -> {
openFile(fileSources, textArea);
contentPane.getChildren().setAll(textArea);
});

Region spacer = new Region();
HBox.setHgrow(spacer, Priority.ALWAYS);
Expand Down

0 comments on commit 1b87d73

Please sign in to comment.