Examples of InsertHTMLTextAction


Examples of javax.swing.text.html.HTMLEditorKit.InsertHTMLTextAction

        action.actionPerformed(new ActionEvent(pane, 0, null));
        assertTrue(listener.occured);
    }

    public void testInsertHRAction() throws Exception {
        InsertHTMLTextAction action = (InsertHTMLTextAction)findActionWithName(
            editorKit.getActions(), "InsertHR");
        assertNotNull(action);

        JEditorPane pane = new JEditorPane();
        pane.setEditorKit(editorKit);
        document = ((HTMLDocument)pane.getDocument());
        document.setAsynchronousLoadPriority(-1)// synchronous loading
        pane.setText("<p>test</p>");
        final int pos = document.getLength() - 1;
        pane.setCaretPosition(pos);

        action.actionPerformed(new ActionEvent(pane, 0, null));
        Element e = document.getCharacterElement(pos + 1);
        assertEquals(HTML.Tag.HR, getHTMLTagByElement(e));
        assertNotNull(e);
        HTML.Tag parentTag = getHTMLTagByElement(e.getParentElement());
        assertTrue(HTML.Tag.P.equals(parentTag) || HTML.Tag.IMPLIED.equals(parentTag));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.