Package javax.swing.text

Examples of javax.swing.text.AttributeSet


                .getInputAttributes();
        assertSame(textPane.getInputAttributes(), inpAttr);
    }

    public void testInsertComponent() {
        AttributeSet attributes;
        textPane.setCaretPosition(1);
        attrs = textPane.getInputAttributes();
        assertAttrubutes(attrs, false, false, true, false, false, true);
        textPane.insertComponent(new JButton("Format C:\\>"));
        assertAttrubutes(attrs, false, false, false, false, false, false);
View Full Code Here


            }
        });
        assertAttrubutes(attrs, false, false, false, false, false, false);
        Element iconElement = textPane.getStyledDocument().getDefaultRootElement()
                .getElement(0).getElement(1);
        AttributeSet attributes = iconElement.getAttributes();
        assertNotNull(attributes.getAttribute(StyleConstants.IconAttribute));
        assertAttrubutes(attributes, false, false, false, false, false, false);
    }
View Full Code Here

        assertNotNull(attributes.getAttribute(StyleConstants.IconAttribute));
        assertAttrubutes(attributes, false, false, false, false, false, false);
    }

    public void testReplaceSelection() throws BadLocationException {
        AttributeSet textAttrs;
        // There is replacement and selection
        textPane.select(6, 22);
        textAttrs = getCharacterAttributes(6);
        assertTrue(StyleConstants.isUnderline(getCharacterAttributes(5)));
        assertFalse(StyleConstants.isUnderline(getCharacterAttributes(6)));
View Full Code Here

        }

        private ElementSpec findLastSpec(final Tag tag) {
            for (int i = parseBuffer.size() - 1; i >= 0; i--) {
                ElementSpec spec = (ElementSpec)parseBuffer.get(i);
                final AttributeSet specAttr = spec.getAttributes();
                if (specAttr != null && specAttr.containsAttribute(StyleConstants.NameAttribute, tag)) {
                    return spec;
                }
            }
            return null;
        }
View Full Code Here

        }

        class AdvancedCharacterAction extends CharacterAction {
            public void start(final Tag tag, final MutableAttributeSet attr) {
                super.start(tag, attr);
                final AttributeSet attrs = getDefaultCSSAttributes(tag);
                if (attrs != null) {
                    charAttr.addAttributes(attrs);
                }
            }
View Full Code Here

        try {
            if (start != end) {
                doc.remove(start, end - start);
            }
            //May be these attributes placed in Document ????
            AttributeSet as = (editorKit instanceof StyledEditorKit) ? ((StyledEditorKit) editorKit)
                    .getInputAttributes()
                    : null;
            if (s != null) {
                doc.insertString(start, s, as);
            }
View Full Code Here

            return;
        }
        HTMLDocument.Iterator it = ((HTMLDocument)doc).getIterator(HTML.Tag.A);
        int offset = 0;
        while (it.isValid()) {
            AttributeSet set = it.getAttributes();
            Object name = set.getAttribute(HTML.Attribute.NAME);
            if (ref.equals(name)) {
                offset = it.getStartOffset();
                break;
            }
            it.next();
View Full Code Here

        int offset = isParagraph(elem) ? elem.getEndOffset() - 1 : elem.getEndOffset();
        insertHTMLText(elem, offset, htmlText);
    }
   
    private boolean isParagraph(final Element elem) {
        final AttributeSet attr = elem.getAttributes();
        return attr != null && Tag.P.equals(attr.getAttribute(StyleConstants.NameAttribute));
    }
View Full Code Here

    protected AbstractElement createDefaultRoot() {
        final BlockElement root = new BlockElement(null, null);
        writeLock();
        try {
            root.addAttribute(StyleConstants.NameAttribute, Tag.HTML);
            AttributeSet attr = getAttributeContext().getEmptySet();
            final BranchElement body = (BranchElement)createBranchElement(root,
                                                                          null);
            body.addAttribute(StyleConstants.NameAttribute, Tag.BODY);
           
            final BranchElement p = (BranchElement)createBranchElement(body, null);
View Full Code Here

                                          final AttributeSet attr) {
        return new BlockElement(parent, attr);
    }
   
    protected void insertUpdate(final DefaultDocumentEvent event, final AttributeSet attrs) {
        AttributeSet contentAttr = attrs;
        if (contentAttr == null) {
            contentAttr = new SimpleAttributeSet();
            ((SimpleAttributeSet)contentAttr).addAttribute(StyleConstants.NameAttribute, Tag.CONTENT);
        }
        super.insertUpdate(event, contentAttr);
View Full Code Here

TOP

Related Classes of javax.swing.text.AttributeSet

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.