14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 import java.io.BufferedWriter;
24 import java.io.File;
25 import java.io.FileWriter;
26 import java.net.URL;
27 import javax.swing.JEditorPane;
28 import javax.swing.JFrame;
29 import javax.swing.JScrollPane;
30 import javax.swing.SwingUtilities;
31 import javax.swing.text.EditorKit;
32 /*
33 * @test
34 * @bug 8031109
35 * @author Victor Dyakov
36 * @summary Rendering HTML code in JEditorPane throws NumberFormatException
37 * @run main bug8031109
38 */
39 public class bug8031109 {
40
41 private static final String TEXT_HTML = "text/html";
42
43 public static void main(String[] args) throws Exception {
44 SwingUtilities.invokeAndWait(new Runnable() {
45
46 @Override
47 public void run() {
48 JEditorPane editorPane = new JEditorPane();
49 editorPane.setEditable(false);
50 EditorKit defaultHtmlEditor = JEditorPane
51 .createEditorKitForContentType(TEXT_HTML);
52 editorPane.setEditorKitForContentType(TEXT_HTML, defaultHtmlEditor);
53 editorPane.setContentType(TEXT_HTML);
|
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 import java.io.BufferedWriter;
24 import java.io.File;
25 import java.io.FileWriter;
26 import java.net.URL;
27 import javax.swing.JEditorPane;
28 import javax.swing.JFrame;
29 import javax.swing.JScrollPane;
30 import javax.swing.SwingUtilities;
31 import javax.swing.text.EditorKit;
32 /*
33 * @test
34 * @key headful
35 * @bug 8031109
36 * @author Victor Dyakov
37 * @summary Rendering HTML code in JEditorPane throws NumberFormatException
38 * @run main bug8031109
39 */
40 public class bug8031109 {
41
42 private static final String TEXT_HTML = "text/html";
43
44 public static void main(String[] args) throws Exception {
45 SwingUtilities.invokeAndWait(new Runnable() {
46
47 @Override
48 public void run() {
49 JEditorPane editorPane = new JEditorPane();
50 editorPane.setEditable(false);
51 EditorKit defaultHtmlEditor = JEditorPane
52 .createEditorKitForContentType(TEXT_HTML);
53 editorPane.setEditorKitForContentType(TEXT_HTML, defaultHtmlEditor);
54 editorPane.setContentType(TEXT_HTML);
|