RFR: 8139228: JFileChooser renders file names as HTML document [v4]
Alexey Ivanov
aivanov at openjdk.org
Wed May 21 16:50:01 UTC 2025
On Wed, 21 May 2025 16:00:12 GMT, Tejesh R <tr at openjdk.org> wrote:
>> The rendering of the directory names are handled as JLabel w.r.t Look and feel and also either Details/List view. Though FilePane creates basic rendering for these two few Look and Feel define their own renderers and also ComboBox Directory directory name view. Since HTML filtering is not taken care in any of these renderers, JLabel renders them as HTML document if nothing is set or specified.
>> The fix is to get "html.disable" property from JFileChooser and set the same to JLabel component which renders and set Directory name. Hence applications can either enable/disable this property and control HTML rendering of directory name.
>
> Tejesh R has updated the pull request incrementally with one additional commit since the last revision:
>
> Updated review comments
Marked as reviewed by aivanov (Reviewer).
test/jdk/javax/swing/JFileChooser/HTMLFileName.java line 61:
> 59: If it appears to be in HTML format with Pink color,
> 60: then test fails.
> 61: (Verify for all Look and Feel).
There's no way for the tester to verify all Look and Feels, unless they go out of their way and launch the test manually with different look and feels.
For this reason, I'd remove this line altogether.
test/jdk/javax/swing/JFileChooser/HTMLFileName.java line 110:
> 108: jfc.putClientProperty("html.disable", htmlEnabled);
> 109: jfc.setControlButtonsAreShown(false);
> 110: JFrame frame = new JFrame((htmlEnabled) ? "HTML enabled" : "HTML disabled");
Suggestion:
jfc.setControlButtonsAreShown(false);
JFrame frame = new JFrame((htmlEnabled) ? "HTML enabled" : "HTML disabled");
It's better with a blank line that separates the two blocks of code.
test/jdk/javax/swing/JFileChooser/HTMLFileName.java line 126:
> 124: return new File[]{
> 125: new File("/", "<html><h1 color=#ff00ff><font " +
> 126: "face=\"Comic Sans MS\">Swing Rocks!!!!111"),
Suggestion:
"face="Comic Sans MS">Swing Rocks!"),
Update this too.
-------------
PR Review: https://git.openjdk.org/jdk/pull/24439#pullrequestreview-2858481116
PR Review Comment: https://git.openjdk.org/jdk/pull/24439#discussion_r2100751517
PR Review Comment: https://git.openjdk.org/jdk/pull/24439#discussion_r2100748073
PR Review Comment: https://git.openjdk.org/jdk/pull/24439#discussion_r2100748940
More information about the client-libs-dev
mailing list