// Add a custom file filter and disable the default
fileChooser.setAcceptAllFileFilterUsed(false);
// add the optionnal (Accept All) file filter.
fileChooser.addChoosableFileFilter(new SvgFileFilter());
// Add the preview pane.
fileChooser.setAccessory(svgPreview = new SvgImagePreview(fileChooser));
File svgDirectory = ((defaultDirectory != null) && defaultDirectory.exists()) ? defaultDirectory
: CurrentPathProvider.currentPathProvider.getCurrentPath();
fileChooser.setCurrentDirectory(svgDirectory);
}
fileChooser.setSelectedFile(currentFile);