Package javax.swing.text

Examples of javax.swing.text.AttributeSet$ParagraphAttribute


        applyAttribute(commentAttr, AWPrefs.PREF_SYNTAX_COMMENT);
        applyAttribute(templateAttr, AWPrefs.PREF_SYNTAX_PARSER);
    }

    public AttributeSet getAttributeForToken(ATEToken token) {
        AttributeSet attr = super.getAttributeForToken(token);
        if (token.scope instanceof ElementTemplateArgumentBlock) {
            if (attr == null)
                attr = labelAttr;
        }
        switch(token.type) {
View Full Code Here


        // No parser need for generic computer language
        return null;
    }

    public AttributeSet getAttributeForToken(ATEToken token) {
        AttributeSet attr = null;
        switch(token.type) {
            case ATESyntaxLexer.TOKEN_COMPLEX_COMMENT:
            case ATESyntaxLexer.TOKEN_SINGLE_COMMENT:
                attr = commentAttr;
                break;
View Full Code Here

  }

  public void print(final Object o, final Font font, final Color color) {
    invokeAndWait(new Runnable() {
      public void run() {
        AttributeSet old = getStyle();
        setStyle(font, color);
        append(String.valueOf(o));
        resetCommandStart();
        text.setCaretPosition(cmdStart);
        setStyle(old, true);
View Full Code Here

      final boolean underline
  )
  {
    invokeAndWait(new Runnable() {
      public void run() {
        AttributeSet old = getStyle();
        setStyle(fontFamilyName, size, color, bold,  italic,  underline);
        append(String.valueOf(o));
        resetCommandStart();
        text.setCaretPosition(cmdStart);
        setStyle(old, true);
View Full Code Here

    {
        Object value = attribs.get( key  );

        if ( value == null )
        {
            AttributeSet parent = getResolveParent();

            if ( parent != null )
            {
                value = parent.getAttribute( key  );
            }
        }

        return value;
    }
View Full Code Here

        assertFalse(jep1.getScrollableTracksViewportHeight());
        assertFalse(jep1.getScrollableTracksViewportWidth());
    }

    private AttributeSet getAttributeSetByIndex(final AbstractDocument d, final int offset) {
        AttributeSet as = null;
        Element elem = d.getDefaultRootElement();
        while (elem.getElementCount() > 0) {
            elem = elem.getElement(elem.getElementIndex(offset));
            as = elem.getAttributes();
        }
View Full Code Here

        jep.setDocument(doc);
        jep.setSelectionStart(6);
        jep.setSelectionEnd(7);
        jep.replaceSelection("YYY");
        for (int i = 0; i < doc.getLength(); i++) {
            AttributeSet as = getAttributeSetByIndex(doc, i);
            if (i > 3 && i < 12) {
                assertEquals(as2, as);
            } else {
                assertEquals(as1, as);
            }
View Full Code Here

        StyleConstants.setStrikeThrough(attrs, true);
        StyleConstants.setAlignment(attrs, StyleConstants.ALIGN_CENTER);
        textPane.getStyledDocument().setParagraphAttributes(paragraph.getStartOffset(),
                paragraph.getEndOffset() - paragraph.getStartOffset(), attrs, true);
        // tests
        AttributeSet textAttrs;
        textPane.setCaretPosition(1);
        textAttrs = textPane.getParagraphAttributes();
        assertFalse(StyleConstants.isUnderline(textAttrs));
        assertTrue(StyleConstants.isStrikeThrough(textAttrs));
        assertEquals(StyleConstants.ALIGN_CENTER, StyleConstants.getAlignment(textAttrs));
View Full Code Here

        assertEquals(StyleConstants.ALIGN_CENTER, StyleConstants.getAlignment(textAttrs));
    }

    public void testSetParagraphAttributes() {
        StyledDocument doc = textPane.getStyledDocument();
        AttributeSet textAttrs;
        // The attributes are applied to the paragraph at the current caret
        // position.
        textPane.setCaretPosition(1);
        StyleConstants.setSubscript(attrs, false);
        doc.setParagraphAttributes(0, doc.getLength(), attrs, false);
View Full Code Here

            }
        });
    }

    public void testGetCharacterAttributes() {
        AttributeSet textAttrs;
        textPane.setCaretPosition(1);
        textAttrs = textPane.getCharacterAttributes();
        assertTrue(StyleConstants.isUnderline(textAttrs));
        assertEquals(StyleConstants.ALIGN_CENTER, StyleConstants.getAlignment(textAttrs));
        assertTrue(StyleConstants.isStrikeThrough(textAttrs));
View Full Code Here

TOP

Related Classes of javax.swing.text.AttributeSet$ParagraphAttribute

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.