How to change JFileChooser text elements?

J

Jacob

If I set my JFileChooser dialog to select directories
only (setFileSelectionMode (JFileChooser.DIRECTORIES_ONLY)),
I whould expect the selection label at the bottom left of
the dialog to say "Directory". No such luck; regardless
of mode it stays at "File Name".

I know I can update JFileChooser properties through the
UIManager like this:

UIManager.put ("FileChooser.fileNameLabelText", "Something");

which I use for localizing, but this will change the property
globally, i.e. for all such dialogs. I want the effect on
a given JFileChooser only! How?

Thanks!
 
A

ak

which I use for localizing, but this will change the property
globally, i.e. for all such dialogs. I want the effect on
a given JFileChooser only! How?

FileChooser chooser = new ...;
chooser.setUI(MyFileChooserUI);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top