Package javax.swing.text

Examples of javax.swing.text.MutableAttributeSet.addAttribute()


            td.setLineThrough(false);
        }
        if (td.isNone()) {
            result.removeAttribute(Attribute.TEXT_DECORATION);
        } else {
            result.addAttribute(Attribute.TEXT_DECORATION, td);
        }
        return super.addAttributes(getEmptySet(), result);
    }

    private String extractURL(final String importPath) {
View Full Code Here


    private void processTarget(final Element target, final String src) {
        final MutableAttributeSet targetAttr = (MutableAttributeSet)target.getAttributes();
        writeLock();
        try {
            targetAttr.addAttribute(HTML.Attribute.SRC, src);
        } finally {
            writeUnlock();
        }
        fireChangedUpdate(new DefaultDocumentEvent(target.getStartOffset(), target.getEndOffset() - target.getStartOffset(), EventType.CHANGE));
    }
View Full Code Here

            impliedBlockOpen = true;
        }

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

        private boolean paragraphOpened() {
            return openedBlocks.contains(PARAGRAPH_TAG) || openedBlocks.contains(Tag.IMPLIED) && impliedBlockOpen;
View Full Code Here

            public void paintIcon(final Component c, final Graphics g,
                                  final int x, final int y) {
            }
        };
        StyleConstants.setIcon(attrs, icon);
        attrs.addAttribute(AbstractDocument.ElementNameAttribute,
                           StyleConstants.IconElementName);
        doc.insertString(doc.getLength(), "ppp", attrs);

        iconElement = doc.getCharacterElement(doc.getLength() - 1);
View Full Code Here

        iconElement = doc.getCharacterElement(doc.getLength() - 1);

        attrs = new SimpleAttributeSet();
        StyleConstants.setComponent(attrs, new JLabel("lab1"));
        attrs.addAttribute(AbstractDocument.ElementNameAttribute,
                           StyleConstants.ComponentElementName);
        doc.insertString(doc.getLength(), "ccc", attrs);
        componentElement = doc.getCharacterElement(doc.getLength() - 1);
    }
}
View Full Code Here

        if (color != null)
        {
          int start = txtInvoer.getSelectionStart();
          int end = txtInvoer.getSelectionEnd();
          MutableAttributeSet set = new SimpleAttributeSet();
          set.addAttribute(StyleConstants.Foreground, color);
          if (end != start)
          {
            StyledDocument doc = (StyledDocument) txtInvoer.getDocument();
            //System.out.println(set);
            doc.setCharacterAttributes(start, end - start, set, false);
View Full Code Here

  }

  public void showActionMessagePart(String message, String action) {
    final MutableAttributeSet attributes = textPane.getStyle("action");
    final String lmessage = message;
    attributes.addAttribute("action", action);
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        synchronized (document) {
          try {
            document.insertString(
View Full Code Here

        assertEquals(0, simple.getAttributeCount());
        ss.addCSSAttribute(simple, Attribute.BACKGROUND_COLOR, "red");
        assertEquals(1, simple.getAttributeCount());

        MutableAttributeSet mas = new SimpleAttributeSet();
        mas.addAttribute(Attribute.BACKGROUND_COLOR, "red");

        Object key1 = simple.getAttributeNames().nextElement();
        Object key2 = mas.getAttributeNames().nextElement();
        assertEquals(key2, key1);
        assertSame(key2, key1);
View Full Code Here

        assertNull(getModelAttribute(elem));

        // Wrong element type name
        createFormView(FormAttributes.INPUT_TYPE_SUBMIT);
        MutableAttributeSet attrs = new SimpleAttributeSet();
        attrs.addAttribute(HTML.Attribute.TYPE, "my_type");
        doc.setCharacterAttributes(22, 1, attrs, false);
        assertEquals("my_type",
                     elem.getAttributes().getAttribute(HTML.Attribute.TYPE));
        assertNull(formView.createComponent());
        assertNull(formView.getComponent());
View Full Code Here

                component.setMaximumSize(new Dimension(30, 30));
                return component;
            };
        };
        MutableAttributeSet attrs = new SimpleAttributeSet();
        attrs.addAttribute(HTML.Attribute.TYPE, "my_type");
        doc.setCharacterAttributes(22, 1, attrs, false);
        assertEquals("my_type",
                     elem.getAttributes().getAttribute(HTML.Attribute.TYPE));
        checkFormViewSpans(0, 0, 0, 0);
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.