Examples of SimpleAttributeSet


Examples of javax.swing.text.SimpleAttributeSet

        assertSame(style, textPane.getLogicalStyle());
        assertTrue(((Boolean) style.getAttribute(StyleConstants.Bold)).booleanValue());
        assertTrue(StyleConstants.isBold(textPane.getParagraphAttributes()));
        assertTrue(StyleConstants.isBold(getCharacterAttributes(1)));
        // Set paragraph attributes
        attrs = new SimpleAttributeSet();
        StyleConstants.setBold(attrs, true);
        textPane.setParagraphAttributes(attrs, true);
        assertNull(textPane.getLogicalStyle());
        // Set another style
        textPane.getStyledDocument().setCharacterAttributes(1, 1, attrs, true);
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

    public void testGetParagraphAttributes() {
        // init paragraph attributeSet
        textPane.setCaretPosition(1);
        Element paragraph = textPane.getStyledDocument().getParagraphElement(
                textPane.getCaretPosition());
        attrs = new SimpleAttributeSet();
        StyleConstants.setStrikeThrough(attrs, true);
        StyleConstants.setAlignment(attrs, StyleConstants.ALIGN_CENTER);
        textPane.getStyledDocument().setParagraphAttributes(paragraph.getStartOffset(),
                paragraph.getEndOffset() - paragraph.getStartOffset(), attrs, true);
        // tests
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

        assertAttrubutes(attrs, false, false, false, false, false, false);
        assertNull(StyleConstants.getComponent(attrs));
        attributes = textPane.getStyledDocument().getCharacterElement(1).getAttributes();
        assertAttrubutes(attributes, false, false, false, false, false, false);
        assertNotNull(StyleConstants.getComponent(attributes));
        attrs = new SimpleAttributeSet(attributes);
        StyleConstants.setUnderline(attrs, true);
        textPane.getStyledDocument().setCharacterAttributes(1, 1, attrs, true);
        textPane.setCaretPosition(1);
        assertAttrubutes(textPane.getInputAttributes(), false, false, true, false, false, true);
        textPane.select(2, 2);
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

        textPane.replaceSelection("1");
        assertEquals(textPane.getStyledDocument().getCharacterElement(0).getAttributes(),
                textPane.getStyledDocument().getCharacterElement(1).getAttributes());
        textPane.select(0, 1);
        textPane.replaceSelection("");
        attrs = new SimpleAttributeSet();
        StyleConstants.setUnderline(attrs, true);
        textPane.getStyledDocument().insertString(0, "Hello!", attrs);
        textPane.select(0, 0);
        textPane.replaceSelection("1");
        assertEquals(textPane.getStyledDocument().getCharacterElement(0).getAttributes(),
                textPane.getStyledDocument().getCharacterElement(1).getAttributes());
        textPane.select(0, 1);
        textPane.replaceSelection("2");
        assertEquals(textPane.getStyledDocument().getCharacterElement(0).getAttributes(),
                textPane.getStyledDocument().getCharacterElement(1).getAttributes());
        textPane.setCaretPosition(1);
        textPane.insertIcon(MetalIconFactory.getFileChooserNewFolderIcon());
        textPane.select(2, 2);
        textPane.replaceSelection("3");
        attrs = new SimpleAttributeSet(textPane.getStyledDocument().getCharacterElement(1)
                .getAttributes());
        assertAttrubutes(attrs, false, false, false, false, false, false);
        assertNotNull(StyleConstants.getIcon(attrs));
        attrs = new SimpleAttributeSet(textPane.getStyledDocument().getCharacterElement(2)
                .getAttributes());
        assertAttrubutes(attrs, false, false, false, false, false, false);
        assertNull(StyleConstants.getIcon(attrs));
    }
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

            for (int i = 0; i < data.length; i++) {
                if ((data[i] == '\n') || (data[i] == '\r')) {
                    addContent(data, offset, i - offset);
                    blockClose(HTML.Tag.IMPLIED);

                    blockOpen(HTML.Tag.IMPLIED, new SimpleAttributeSet());
                    offset = i + 1;
                }
            }

            if (offset < data.length) {
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

        private void createImpliedBlock() {
            if (paragraphOpened()) {
                return;
            }
            blockOpen(Tag.IMPLIED, new SimpleAttributeSet());
            impliedBlockOpen = true;
        }
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

            blockOpen(Tag.IMPLIED, new SimpleAttributeSet());
            impliedBlockOpen = true;
        }

        private MutableAttributeSet createMutableSet(final Object key, final Object value) {
            MutableAttributeSet specAttr = new SimpleAttributeSet();
            specAttr.addAttribute(key, value);
            return specAttr;
        }
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

        }

        private SimpleAttributeSet deriveSpecAttributes(final Tag tag, final MutableAttributeSet attr) {
            attr.removeAttribute(IMPLIED);
            attr.addAttribute(StyleConstants.NameAttribute, tag);
            return new SimpleAttributeSet(attr);
        }
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

        public class IsindexAction extends TagAction {
            public void start(final Tag tag, final MutableAttributeSet attr) {
                addJoinPreviousSpec = true;
                checkInsertTag(tag);
                blockOpen(Tag.IMPLIED, new SimpleAttributeSet());
                addSpecialElement(tag, attr);
                blockClose(Tag.IMPLIED);
            }
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

        }

        public class PreAction extends BlockAction {
            public void start(final Tag tag, final MutableAttributeSet attr) {
                super.start(tag, attr);
                MutableAttributeSet blockAttr = new SimpleAttributeSet(attr);
                SimpleAttributeSet defaultAttr = getDefaultCSSAttributes(tag);
                if (defaultAttr != null) {
                    blockAttr.addAttributes(defaultAttr);
                }
                blockOpen(Tag.IMPLIED, blockAttr);
                impliedBlockOpen = true;
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.