diff --git a/test/jdk/javax/swing/JFileChooser/HTMLFileName.java b/test/jdk/javax/swing/JFileChooser/HTMLFileName.java
index 45d9cb4c449..a8bc9525cca 100644
--- a/test/jdk/javax/swing/JFileChooser/HTMLFileName.java
+++ b/test/jdk/javax/swing/JFileChooser/HTMLFileName.java
@@ -52,24 +52,35 @@ public class HTMLFileName {
private static final String INSTRUCTIONS = """
- - FileChooser shows up a virtual directory and file with name
-
Swing Rocks!.
- - On "HTML disabled" frame :
+
JFileChooser shows a virtual directory.
+ The first file in the list has the following name:
+ <html><h1 color=#ff00ff><font
+ face="Serif">Swing Rocks!
+
+
+ - In HTML disabled frame:
- - Verify that the folder and file name must be plain text.
-
- If the name in file pane window and also in directory
- ComboBox remains in plain text, then press Pass.
- If it appears to be in HTML format with Pink color as
- shown, then press Fail.
+
- Verify that the first file name displays
+ as plain text,
+ that is you see the HTML tags in the file name.
+
- If the file name in the file pane and
+ in the navigation combo box above is displayed
+ as HTML, that is in large font and magenta color,
+ then press Fail.
- - On "HTML enabled" frame :
+
- In HTML enabled frame:
- - Verify that the folder and file name remains in HTML
- format with name "Swing Rocks!" pink in color as shown.
-
- If the name in file pane window and also in directory
- ComboBox remains in HTML format string, then press Pass.
- If it appears to be in plain text, then press Fail.
+
- Verify that the first file name displays as HTML,
+ that is
Swing Rocks! in large font
+ and magenta color.
+ Note: On macOS in Aqua L&F, the file name with
+ HTML displays as an empty file name. It is not an error.
+ - If the file name in the file pane and
+ in the navigation combo box above is displayed
+ as HTML, then press Pass.
+ If it is in plain text, then press Fail.
@@ -99,6 +110,7 @@ public class HTMLFileName {
PassFailJFrame.builder()
.instructions(INSTRUCTIONS)
.columns(45)
+ .rows(20)
.testUI(HTMLFileName::initialize)
.positionTestUIBottomRowCentered()
.build()
@@ -110,18 +122,25 @@ public class HTMLFileName {
return List.of(createFileChooser(true), createFileChooser(false));
}
- private static JFrame createFileChooser(boolean htmlEnabled) {
+ private static JFrame createFileChooser(boolean htmlDisabled) {
JFileChooser jfc = new JFileChooser(new VirtualFileSystemView());
- jfc.putClientProperty("html.disable", htmlEnabled);
+ jfc.putClientProperty("html.disable", htmlDisabled);
jfc.setControlButtonsAreShown(false);
- JFrame frame = new JFrame((htmlEnabled) ? "HTML enabled" : "HTML disabled");
+ JFrame frame = new JFrame(htmlDisabled ? "HTML disabled" : "HTML enabled");
frame.add(jfc);
frame.pack();
return frame;
}
private static class VirtualFileSystemView extends FileSystemView {
+ private final File[] files = {
+ new File("/", "Swing Rocks!"),
+ new File("/", "virtualFile1.txt"),
+ new File("/", "virtualFile2.log")
+ };
+
@Override
public File createNewFolder(File containingDir) {
return null;
@@ -129,12 +148,7 @@ public class HTMLFileName {
@Override
public File[] getRoots() {
- return new File[]{
- new File("/", "Swing Rocks!"),
- new File("/", "virtualFile2.txt"),
- new File("/", "virtualFolder")
- };
+ return files;
}
@Override
@@ -150,12 +164,7 @@ public class HTMLFileName {
@Override
public File[] getFiles(File dir, boolean useFileHiding) {
// Simulate a virtual folder structure
- return new File[]{
- new File("/", "Swing Rocks!"),
- new File(dir, "virtualFile2.txt"),
- new File(dir, "virtualFolder")
- };
+ return files;
}
@Override