Reputation: 2206
I realise using Swing and JFileChooser, this is a simple of case of using getFileFilter
but I can't seem to find any similar options in JavaFX2 for it's FileChooser.
The problem is that when saving a file, if no file extension is explicitly typed by the user, I want the file to be appended with the current selected file extension in the FileChooser drop-down box.
In the image below, I would like this file to be saved as text.xml, for example.
Upvotes: 4
Views: 1436
Reputation: 8900
This issue already reported in jaavfx-jira.You Can trck the status here unable to save file name with selected extension filter.
I am copy pasting info here for quick reference :
Description : Create a simple program to launch a FileChooser SaveDialog, and add several extension filters, for example: *.txt, *.java, .. Run the program, when the save dialog is displayed, select *.txt from the filters, and type file name without extension, then click "Save". Observe the file name to save, the extension ".txt" is not attached, and it seems there is no method of FileChooser to get the selected filter extension. Not sure if it's an expected feature, but it's not convenient.
Type: Feature Status: Open Priority: Medium Resolution: Unresolved
Upvotes: 2