Is there a way to change the style (font color) of a specific file entry in a JFileChooser?

62 Views Asked by At

I'm currently working on a small app, and I have a list of files that are specific, and I have their abosolute path. I was wondering if there was a way to specifically target a file entry in a JFileChooser to change its font color (I'd guess with setForeground), and if there is a way to do so while changing directories (in a Listener callback I'd guess)

Here is the section of code where I generate the JFileChooser :

JFileChooser fileChooser = new JFileChooser();
FileFilter filter = new FileNameExtensionFilter("CSV files", new String[] {"csv"});
fileChooser.setFileFilter(filter);
fileChooser.setCurrentDirectory(new File(dirname));
int result = fileChooser.showOpenDialog(parent);
if (result == JFileChooser.APPROVE_OPTION) {
    File selectedFile = fileChooser.getSelectedFile();
    Visualizer.loadCase(selectedFile.getAbsolutePath());
}

Thanks for your help !

0

There are 0 best solutions below