Reputation: 6352
I'm working on a library that will translate all the hard-coded strings in swing.
I have, with some help, managed to find all the strings related to it, so that's a start. However, I have noticed that upon trying to rename a file in JFileChooser
to a name that was already taken, I get an error dialog saying that I can't do that.
Was this Java, or was it Windows (OS on which the program was ran)?
If it was Java, I'd like to know more about how to customize such a JDialog
, and if it was Windows, there's not much I can do, especially since the program is supposed to be cross-platform.
Upvotes: 1
Views: 117
Reputation: 1066
You can find the source code of your JDK in the directory you installed it in.
In the openJDK-7 implementation the String you are looking for is defined in the
package com.sun.swing.internal.plaf.basic.resources
and the file basic.java
.
The other files in this directory correspond to the different translations:
basic_de.java
, basic_es.java
, ..., etc.
There are all the String constants that are used by the Swing classes.
Amongst them:
{ "FileChooser.renameErrorFileExists.textAndMnemonic",
"Cannot rename {0}: A file with the name you specified already exists. Specify a different file name." },
So you will have to find a way to override the Attribute FileChooser.renameErrorFileExists.textAndMnemonic
to change this dialog.
If you want to translate these strings refer to this answer.
Different Java installations might have different Strings there since these Files are not part of the official Java API.
As far as I can tell these files are not contained in the src.zip
that is distributed by Oracle.
Upvotes: 1