Package javax.swing.text

Examples of javax.swing.text.EditorKit


        assertSame(textPane.getEditorKit(), textPane.getStyledEditorKit());
        assertSame(textPane.getStyledEditorKit(), textPane.getStyledEditorKit());
    }

    public void testCreateDefaultEditorKit() {
        EditorKit editorKit1 = textPane.createDefaultEditorKit();
        EditorKit editorKit2 = textPane.createDefaultEditorKit();
        assertNotSame(editorKit1, editorKit2);
        assertEquals("javax.swing.text.StyledEditorKit", editorKit1.getClass().getName());
    }
View Full Code Here


    this.setContentType("text/html");
  }
 
  public void appendText(String html) throws Exception {
    Document doc = this.getDocument();
    EditorKit ek = this.getEditorKit();
    ((HTMLEditorKit) ek).insertHTML((HTMLDocument) doc, doc
        .getEndPosition().getOffset() - 1, html,1,0, null);
  }
View Full Code Here

          text = "<font color="+color+">" + text + "</font>";
          Document doc = chatLog.getDocument();
            try
            {
                Reader reader = new StringReader(text);
                EditorKit kit = chatLog.getEditorKit();
                kit.read(reader, doc, doc.getLength());
            }
            catch (Exception e)
            {
                System.out.println("Exception en appendText:" + e.getMessage());
            }
View Full Code Here

        assertNull(basicTextUI.create(elem));
        assertNull(basicTextUI.create(elem, 0, 5));
    }

    public void testGetEditorKit() {
        EditorKit editorKit = basicTextUI.getEditorKit(jta);
        assertTrue(editorKit instanceof DefaultEditorKit);
        assertFalse(editorKit instanceof StyledEditorKit);
        //JEditorPane is not support yet
        //assertEquals(editorKit, basicTextUI.getEditorKit(new JTextPane()));
        //assertEquals(editorKit, basicTextUI.getEditorKit(new JEditorPane()));
View Full Code Here

        testList.remove(listener1);
        assertEquals(testList, listeners);
    }

    public void testCreateDefaultEditorKit() {
        EditorKit kit1 = jep.createDefaultEditorKit();
        EditorKit kit2 = jep.createDefaultEditorKit();
        assertEquals("javax.swing.JEditorPane$PlainEditorKit", kit1.getClass().getName());
        assertNotSame(kit1, kit2);
    }
View Full Code Here

            throw new UnsupportedOperationException("Not implemented");
        }
        SimplePropertyChangeListener listener = new SimplePropertyChangeListener();
        jep.addPropertyChangeListener("editorKit", listener);
        PropertyChangeEvent event;
        EditorKit kit0 = jep.getEditorKit();
        SimpleEditorKit kit1 = new SimpleEditorKit();
        SimpleEditorKit kit2 = new SimpleEditorKit();
        assertEquals("javax.swing.JEditorPane$PlainEditorKit", kit0.getClass().getName());
        event = new PropertyChangeEvent(jep, "editorKit", kit0, kit1);
        jep.setEditorKit(kit1);
        assertEquals(kit1, jep.getEditorKit());
        assertEquals(event, listener.event);
        assertTrue(kit1.wasCallInstall);
        assertFalse(kit1.wasCallDeinstall);
        listener.resetDbgInfo();
        kit1.resetDbgInfo();
        event = new PropertyChangeEvent(jep, "editorKit", kit1, kit2);
        jep.setEditorKit(kit2);
        assertEquals(kit2, jep.getEditorKit());
        assertEquals(event, listener.event);
        assertTrue(kit2.wasCallInstall);
        assertFalse(kit2.wasCallDeinstall);
        assertFalse(kit1.wasCallInstall);
        assertTrue(kit1.wasCallDeinstall);
        kit2.resetDbgInfo();
        jep.setEditorKit(null);
        kit0 = jep.getEditorKit();
        event = new PropertyChangeEvent(jep, "editorKit", kit2, kit0);
        assertEquals("javax.swing.JEditorPane$PlainEditorKit", kit0.getClass().getName());
        assertTrue(kit2.wasCallDeinstall);
        //temporarily commented-out: HTMLEditorKit,
        //DefaultStyledDocument not implemented
        /*assertEquals("text/plain", jep.getContentType());
         jep.setEditorKit(new HTMLEditorKit());
View Full Code Here

        assertEquals("JEditorPane.honorDisplayProperties", JEditorPane.HONOR_DISPLAY_PROPERTIES);
        assertEquals("JEditorPane.w3cLengthUnits", JEditorPane.W3C_LENGTH_UNITS);
    }

    public void testPlainEditorKit() {
        EditorKit kit = jep.getEditorKit();
        assertEquals(kit, kit.getViewFactory());
    }
View Full Code Here

        thread1.go();
        ThreadCheckEditorKit thread2 = new ThreadCheckEditorKit(false);
        thread2.go();

        Map<EditorKit, Object> kitMap = new HashMap<EditorKit, Object>();
        EditorKit result;

        for (int i = 0; i < 9; i++) {
            result = thread1.result[i];

            if (i < 3) {
                assertNull(result);
            } else {
                assertNotNull(result);
                kitMap.put(result, null);
                assertEquals(result.getClass().getClassLoader(),
                        ((i % 3) == 2) ? classLoader2 : classLoader1);
            }
            result = thread2.result[i];
            assertNotNull(result);
            kitMap.put(result, null);
            assertEquals(result.getClass().getClassLoader(),
                    (((i % 3) == 2) ? classLoader2 : classLoader1));
        }
        // Make sure all returned values are unique.
        assertEquals(kitMap.size(), 15);
    }
View Full Code Here

    final JDialog dlg;

    public cxHelper() {
        JEditorPane jep = new JEditorPane();
        dlg = new JDialog(this, "Help", false);
        EditorKit ek = new HTMLEditorKit();
        ek.install(jep);
        jep.setEditorKit(ek);
        try {
            jep.read(getClass().getResourceAsStream("hlp/gxTool.htm"), "");
        } catch (Exception e) {
            jep.setText("<html>�� ������� ��������� [gxTool.htm]</html>");
View Full Code Here

     *
     * @return the value obtained from the first UI, which is
     * the UI obtained from the default <code>LookAndFeel</code>
     */
    public EditorKit getEditorKit(JTextComponent a) {
        EditorKit returnValue =
            ((TextUI) (uis.elementAt(0))).getEditorKit(a);
        for (int i = 1; i < uis.size(); i++) {
            ((TextUI) (uis.elementAt(i))).getEditorKit(a);
        }
        return returnValue;
View Full Code Here

TOP

Related Classes of javax.swing.text.EditorKit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.