Defaults for JFileChooser?  
Author Message
Laird Nelson





PostPosted: 2004-2-19 3:10:00 Top

java-programmer, Defaults for JFileChooser? Any idea how the look and feel mechanism loads the text items for
JFileChooser? I began digging in the source code for UIManager.java,
BasicFileChooserUI.java, and others, and rapidly got lost.

Ultimately a call is made to, e.g.,
UIManager.getString("FileChooser.helpButtonToolTipText", someLocale),
but I can't figure out how the UIDefaults that UIManager uses to locate
this string is actually initialized.

Thanks,
Laird
 
Laird Nelson





PostPosted: 2004-2-19 3:19:00 Top

java-programmer >> Defaults for JFileChooser? Laird Nelson wrote:

> Any idea how the look and feel mechanism loads the text items for
> JFileChooser?

Partially answering my own question: BasicLookAndFeel.java at line 233
does a
table.addResourceBundle("com.sun.swing.internal.plaf.basic.resources.basic")
call, which of course ultimately results in that resource bundle being
loaded.

Now, my follow-on question. I'm extending JFileChooser and require some
internationalized strings. I could of course load my own resource
bundle and get the messages that way, but I was wondering if there's
some hook to simply get my extra messages installed into the UIDefaults
table in some sort of non-hackish way?

Laird
 
ak





PostPosted: 2004-2-19 6:21:00 Top

java-programmer >> Defaults for JFileChooser? one hint - UIDefaults is just a Hashtable with added accessor methods.

____________

http://reader.imagero.com the best java image reader.

"Laird Nelson" <email***@***.com> schrieb im Newsbeitrag
news:email***@***.com...
> Laird Nelson wrote:
>
> > Any idea how the look and feel mechanism loads the text items for
> > JFileChooser?
>
> Partially answering my own question: BasicLookAndFeel.java at line 233
> does a
>
table.addResourceBundle("com.sun.swing.internal.plaf.basic.resources.basic")
> call, which of course ultimately results in that resource bundle being
> loaded.
>
> Now, my follow-on question. I'm extending JFileChooser and require some
> internationalized strings. I could of course load my own resource
> bundle and get the messages that way, but I was wondering if there's
> some hook to simply get my extra messages installed into the UIDefaults
> table in some sort of non-hackish way?
>
> Laird


 
 
Laird Nelson





PostPosted: 2004-2-19 21:46:00 Top

java-programmer >> Defaults for JFileChooser? ak wrote:
> one hint - UIDefaults is just a Hashtable with added accessor methods.

Well, right, but I was hoping I could have it initialize itself in the
same way that it is initialized for JFileChooser. You'll notice that
nothing really seems to *call* those accessor methods, at least where
JFileChooser or its UI component are concerned.

It looks like there's a way to have the UIManager add a ResourceBundle
to a list of ResourceBundles it consults to build the UIDefaults object
(a Hashtable, as you correctly point out).

Laird