< prev index next >

test/jdk/javax/swing/JEditorPane/8080972/TestJEditor.java

Print this page




  23 import java.io.IOException;
  24 import java.io.InputStream;
  25 import java.io.OutputStream;
  26 import java.io.Reader;
  27 import java.io.Writer;
  28 import javax.swing.Action;
  29 import javax.swing.JEditorPane;
  30 import javax.swing.SwingUtilities;
  31 import javax.swing.text.BadLocationException;
  32 import javax.swing.text.Caret;
  33 import javax.swing.text.Document;
  34 import javax.swing.text.EditorKit;
  35 import javax.swing.text.ViewFactory;
  36 
  37 /*
  38  * @test
  39  * @bug 8080972 8169887
  40  * @summary Audit Core Reflection in module java.desktop for places that will
  41  *          require changes to work with modules
  42  * @author Alexander Scherbatiy

  43  */
  44 public class TestJEditor {
  45 
  46     public static void main(String[] args) throws Exception {
  47 
  48         SwingUtilities.invokeAndWait(TestJEditor::testJEditorPane);
  49         System.setSecurityManager(new SecurityManager());
  50         SwingUtilities.invokeAndWait(TestJEditor::testJEditorPane);
  51     }
  52 
  53     private static void testJEditorPane() {
  54 
  55         try {
  56 
  57             JEditorPane.registerEditorKitForContentType("text/html", UserEditorKit.class.getName());
  58             EditorKit editorKit = JEditorPane.createEditorKitForContentType("text/html");
  59 
  60             if (!(editorKit instanceof UserEditorKit)) {
  61                 throw new RuntimeException("Editor kit is not UserEditorKit!");
  62             }




  23 import java.io.IOException;
  24 import java.io.InputStream;
  25 import java.io.OutputStream;
  26 import java.io.Reader;
  27 import java.io.Writer;
  28 import javax.swing.Action;
  29 import javax.swing.JEditorPane;
  30 import javax.swing.SwingUtilities;
  31 import javax.swing.text.BadLocationException;
  32 import javax.swing.text.Caret;
  33 import javax.swing.text.Document;
  34 import javax.swing.text.EditorKit;
  35 import javax.swing.text.ViewFactory;
  36 
  37 /*
  38  * @test
  39  * @bug 8080972 8169887
  40  * @summary Audit Core Reflection in module java.desktop for places that will
  41  *          require changes to work with modules
  42  * @author Alexander Scherbatiy
  43  * @run main/othervm TestJEditor
  44  */
  45 public class TestJEditor {
  46 
  47     public static void main(String[] args) throws Exception {
  48 
  49         SwingUtilities.invokeAndWait(TestJEditor::testJEditorPane);
  50         System.setSecurityManager(new SecurityManager());
  51         SwingUtilities.invokeAndWait(TestJEditor::testJEditorPane);
  52     }
  53 
  54     private static void testJEditorPane() {
  55 
  56         try {
  57 
  58             JEditorPane.registerEditorKitForContentType("text/html", UserEditorKit.class.getName());
  59             EditorKit editorKit = JEditorPane.createEditorKitForContentType("text/html");
  60 
  61             if (!(editorKit instanceof UserEditorKit)) {
  62                 throw new RuntimeException("Editor kit is not UserEditorKit!");
  63             }


< prev index next >