@@ -52,24 +52,35 @@ public class HTMLFileName {
5252 private static final String INSTRUCTIONS = """
5353 <html>
5454 <ol>
55- <li>FileChooser shows up a virtual directory and file with name
56- <html><h1 color=#ff00ff><font face="Comic Sans MS">Swing Rocks!.
57- <li>On "HTML disabled" frame :
55+ <li><code>JFileChooser</code> shows a virtual directory.
56+ The first file in the list has the following name:
57+ <code><html><h1 color=#ff00ff><font
58+ face="Serif">Swing Rocks!</code>
59+ <br>
60+ <br>
61+ <li>In <b>HTML disabled</b> frame:
5862 <ol>
59- <li>Verify that the folder and file name must be plain text.
60- <li>If the name in file pane window and also in directory
61- ComboBox remains in plain text, then press <b>Pass</b>.
62- If it appears to be in HTML format with Pink color as
63- shown, then press <b>Fail</b>.
63+ <li>Verify that the first file name displays
64+ as <em>plain text</em>,
65+ that is you see the HTML tags in the file name.
66+ <li>If the file name in the file pane and
67+ in the navigation combo box above is displayed
68+ as HTML, that is in large font and magenta color,
69+ then press <b>Fail</b>.
6470 </ol>
6571
66- <li>On " HTML enabled" frame :
72+ <li>In <b> HTML enabled</b> frame:
6773 <ol>
68- <li>Verify that the folder and file name remains in HTML
69- format with name "Swing Rocks!" pink in color as shown.
70- <li>If the name in file pane window and also in directory
71- ComboBox remains in HTML format string, then press <b>Pass</b>.
72- If it appears to be in plain text, then press <b>Fail</b>.
74+ <li>Verify that the first file name displays as <em>HTML</em>,
75+ that is <code><font face="Serif"
76+ color=#ff00ff>Swing Rocks!</code> in large font
77+ and magenta color.<br>
78+ <b>Note:</b> On macOS in Aqua L&F, the file name with
79+ HTML displays as an empty file name. It is not an error.
80+ <li>If the file name in the file pane and
81+ in the navigation combo box above is displayed
82+ as HTML, then press <b>Pass</b>.<br>
83+ If it is in plain text, then press <b>Fail</b>.
7384 </ol>
7485 </ol>
7586 </html>
@@ -99,6 +110,7 @@ public static void main(String[] args) throws Exception {
99110 PassFailJFrame .builder ()
100111 .instructions (INSTRUCTIONS )
101112 .columns (45 )
113+ .rows (20 )
102114 .testUI (HTMLFileName ::initialize )
103115 .positionTestUIBottomRowCentered ()
104116 .build ()
@@ -110,31 +122,33 @@ private static List<JFrame> initialize() {
110122 return List .of (createFileChooser (true ), createFileChooser (false ));
111123 }
112124
113- private static JFrame createFileChooser (boolean htmlEnabled ) {
125+ private static JFrame createFileChooser (boolean htmlDisabled ) {
114126 JFileChooser jfc = new JFileChooser (new VirtualFileSystemView ());
115- jfc .putClientProperty ("html.disable" , htmlEnabled );
127+ jfc .putClientProperty ("html.disable" , htmlDisabled );
116128 jfc .setControlButtonsAreShown (false );
117129
118- JFrame frame = new JFrame (( htmlEnabled ) ? "HTML enabled " : "HTML disabled " );
130+ JFrame frame = new JFrame (htmlDisabled ? "HTML disabled " : "HTML enabled " );
119131 frame .add (jfc );
120132 frame .pack ();
121133 return frame ;
122134 }
123135
124136 private static class VirtualFileSystemView extends FileSystemView {
137+ private final File [] files = {
138+ new File ("/" , "<html><h1 color=#ff00ff><font " +
139+ "face=\" Serif\" >Swing Rocks!" ),
140+ new File ("/" , "virtualFile1.txt" ),
141+ new File ("/" , "virtualFile2.log" )
142+ };
143+
125144 @ Override
126145 public File createNewFolder (File containingDir ) {
127146 return null ;
128147 }
129148
130149 @ Override
131150 public File [] getRoots () {
132- return new File []{
133- new File ("/" , "<html><h1 color=#ff00ff><font " +
134- "face=\" Comic Sans MS\" >Swing Rocks!" ),
135- new File ("/" , "virtualFile2.txt" ),
136- new File ("/" , "virtualFolder" )
137- };
151+ return files ;
138152 }
139153
140154 @ Override
@@ -150,12 +164,7 @@ public File getDefaultDirectory() {
150164 @ Override
151165 public File [] getFiles (File dir , boolean useFileHiding ) {
152166 // Simulate a virtual folder structure
153- return new File []{
154- new File ("/" , "<html><h1 color=#ff00ff><font " +
155- "face=\" Comic Sans MS\" >Swing Rocks!" ),
156- new File (dir , "virtualFile2.txt" ),
157- new File (dir , "virtualFolder" )
158- };
167+ return files ;
159168 }
160169
161170 @ Override
0 commit comments