1
1
/*
2
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
21
21
* questions.
22
22
*/
23
23
24
+ import javax .swing .JEditorPane ;
25
+ import javax .swing .JPanel ;
26
+ import javax .swing .JScrollPane ;
27
+ import javax .swing .text .MutableAttributeSet ;
28
+ import javax .swing .text .SimpleAttributeSet ;
29
+ import javax .swing .text .StyleConstants ;
30
+ import javax .swing .text .StyledEditorKit ;
31
+
24
32
/* @test
25
- @bug 4984669 8002148
26
- @summary Tests HTML underlining
27
- @author Peter Zhelezniakov
28
- @run applet/manual=yesno bug4984669.html
29
- */
30
- import javax .swing .*;
31
- import javax .swing .text .*;
33
+ * @bug 4984669 8002148
34
+ * @summary Tests HTML underlining
35
+ * @library /java/awt/regtesthelpers
36
+ * @build PassFailJFrame
37
+ * @run main/manual htmlUnderliningTest
38
+ */
39
+
40
+ public class htmlUnderliningTest {
41
+ public static void main (String [] args ) throws Exception {
42
+ String testInstructions = """
43
+ The four lines printed in a bold typeface should all be underlined.
44
+ It is a bug if any of these lines is underlined only partially.
45
+ The very first line should not be underlined at all.
46
+ """ ;
47
+
48
+ PassFailJFrame .builder ()
49
+ .title ("Test Instructions" )
50
+ .instructions (testInstructions )
51
+ .rows (4 )
52
+ .columns (35 )
53
+ .splitUI (htmlUnderliningTest ::initializeTest )
54
+ .build ()
55
+ .awaitAndCheck ();
56
+ }
32
57
33
- public class bug4984669 extends JApplet
34
- {
35
- public void init () {
58
+ public static JPanel initializeTest () {
59
+ JPanel panel = new JPanel ();
36
60
JEditorPane pane = new JEditorPane ();
37
- this . getContentPane () .add (new JScrollPane (pane ));
61
+ panel .add (new JScrollPane (pane ));
38
62
pane .setEditorKit (new StyledEditorKit ());
39
63
40
64
try {
41
- pane .getDocument ().insertString (0 ,"12 \n " ,null );
65
+ pane .getDocument ().insertString (0 , "12 \n " , null );
42
66
MutableAttributeSet attrs = new SimpleAttributeSet ();
43
67
44
68
StyleConstants .setFontSize (attrs , 36 );
@@ -51,5 +75,6 @@ public void init() {
51
75
} catch (Exception e ) {
52
76
throw new Error ("Failed: Unexpected Exception" , e );
53
77
}
78
+ return panel ;
54
79
}
55
80
}
0 commit comments