Package javax.swing.text

Examples of javax.swing.text.Element


            new ActivateLinkAction()
        };
    }

    private static void activateLink(final int pos, final JEditorPane editor) {
        Element elem = getLinkElement(editor, pos);
        if (elem != null) {
            fireHyperlinkEvent(editor, HyperlinkEvent.EventType.ACTIVATED,
                               elem);
        }
    }
View Full Code Here


                                                  urlString, elem);
        pane.fireHyperlinkUpdate(event);
    }

    private static Element getLinkElement(final JEditorPane pane, final int pos) {
        Element e = (((HTMLDocument)pane.getDocument()).getCharacterElement(pos));
        for (; e != null; e = e.getParentElement()) {
            if (getURLString(e) != null) {
                return e;
            }
        }
View Full Code Here

        protected int elementCountToTag(final HTMLDocument doc,
                                        final int offset,
                                        final HTML.Tag tag) {
            int count = -1;
            Element e;
            for (e = doc.getCharacterElement(offset);
                 e != null && !tag.equals(getHTMLTagByElement(e));
                 e = e.getParentElement()) {
                count++;
            }
            if (e == null) {
                return -1;
            }
View Full Code Here

        }

        protected Element findElementMatchingTag(final HTMLDocument doc,
                                                 final int offset,
                                                 final HTML.Tag tag) {
            Element e = doc.getCharacterElement(offset);
            while (e != null && !tag.equals(getHTMLTagByElement(e))) {
                e = e.getParentElement();
            }
            return e;
        }
View Full Code Here

        }

        protected Element[] getElementsAt(final HTMLDocument doc,
                                          final int offset) {
            ArrayList list = new ArrayList();
            Element e = doc.getDefaultRootElement();
            while (true) {
                list.add(e);
                if (e.getElementCount() == 0) {
                    break;
                }
                e = e.getElement(e.getElementIndex(offset));
            }

            return (Element[])list.toArray(new Element[list.size()]);
        }
View Full Code Here

            }
            if (popDepth == -1) {
                return;
            }

            Element insertElement = findElementMatchingTag(doc, offset,
                                                           usedParentTag);
            if (insertElement.getStartOffset() == offset) {
                insertAtBoundary(editor, doc, offset, insertElement, html,
                                 usedParentTag, usedAddTag);
            } else {
                int pushDepth = 0;
                insertHTML(editor, doc, offset, html,
View Full Code Here

            // does nothing
        }

        public void mouseMoved(final MouseEvent e) {
            JEditorPane pane = (JEditorPane)e.getSource();
            Element linkElement = getLinkElement(pane, e.getPoint());
            updateMouseCursor(e, linkElement);

            if (pane.isEditable()) {
                return;
            }
View Full Code Here

            fireHyperlinkEvent(e, linkElement);
        }

        protected void activateLink(final int pos, final JEditorPane editor) {
            Element elem = HTMLEditorKit.getLinkElement(editor, pos);
            if (elem != null) {
                HTMLEditorKit.fireHyperlinkEvent(editor,
                        HyperlinkEvent.EventType.ACTIVATED, elem);
            }
        }
View Full Code Here

            JEditorPane editor = getEditor(e);
            Caret caret = editor.getCaret();
            HTMLDocument doc = getHTMLDocument(editor);

            Element link = getNextLinkElement(doc, caret.getDot(), isForward());
            if (link != null) {
                moveHighlight(editor,
                              link.getStartOffset(), link.getEndOffset());
            }
        }
View Full Code Here

    }

    public static String getElementTreeSelector(final Element element) {
        final StringBuffer result = new StringBuffer();
        result.append(getFullName(element));
        Element parent = element.getParentElement();
        while (parent != null) {
            result.insert(0, ' ');
            result.insert(0, getFullName(parent));
            parent = parent.getParentElement();
        }
        return result.toString();
    }
View Full Code Here

TOP

Related Classes of javax.swing.text.Element

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.