Hi Dear friends,
I'm dealing with, change the content pane color of jFilechooser. Color has been changed but the problem is when I open the subdirectory leads errors;
Note : It also trigger error when I set default directory; like chooser.setCurrentDirectory(file);
Please help me.
In future, while posting code, please UseCodeTags I have added them this time for you. As you can see the tags make the code much more easier to read and understand.
Why are you adding an action listener to your file chooser? That is not necessary. You can read about file choosers in the Java® Tutorials.
Doesn't the file chooser have a setBackground method? I thought all components had a setBackground method.
After going through whatever I could trace, I've found a workaround for what I believe to be a bug in the Swing code. Add one line:By the way, as a courtesy to those who copy and run your code, you shouldsetDefaultCloseOperation(EXIT_ON_CLOSE) for any JFrame.
luck, db
There are no new questions, but there may be new answers.
The method updateUI() is JFileChooser first calls setUI() then updates the
uiFileView value from the new UI instance. If the setUI() method is called
from anywhere else, then this update is not performed.
luck, db
There are no new questions, but there may be new answers.
Hi Darryl; given last (setFileView(...)) is work fine as well as UpdateUI() also, but as you suggest it might lose the cutomization, so I would go with setFileView(...).