Package javax.swing.text

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


    harness.checkPoint("getAttributeCount()");
     
    SimpleAttributeSet s = new SimpleAttributeSet();
    harness.check(s.getAttributeCount(), 0);

    s.addAttribute("X1", "Y1");
    harness.check(s.getAttributeCount(), 1);
     
    // add an attribute that exists in the resolve parent, same value
    SimpleAttributeSet sParent = new SimpleAttributeSet();
    s.setResolveParent(sParent);
View Full Code Here


    // add an attribute that exists in the resolve parent, same value
    SimpleAttributeSet sParent = new SimpleAttributeSet();
    s.setResolveParent(sParent);
    harness.check(s.getAttributeCount(), 2);
   
    sParent.addAttribute("X2", "Y2");
    harness.check(s.getAttributeCount(), 2);
    sParent.addAttribute("X3", "Y3");
    harness.check(s.getAttributeCount(), 2);
   
    s.addAttribute("X2", "YY2");
View Full Code Here

    s.setResolveParent(sParent);
    harness.check(s.getAttributeCount(), 2);
   
    sParent.addAttribute("X2", "Y2");
    harness.check(s.getAttributeCount(), 2);
    sParent.addAttribute("X3", "Y3");
    harness.check(s.getAttributeCount(), 2);
   
    s.addAttribute("X2", "YY2");
    harness.check(s.getAttributeCount(), 3);     
  }
View Full Code Here

  {
    harness.checkPoint("isDefined()");
     
    SimpleAttributeSet s = new SimpleAttributeSet();
    harness.check(s.isDefined("X1"), false);
    s.addAttribute("X1", "Y1");
    harness.check(s.isDefined("X1"), true);
    s.removeAttribute("X1");
    harness.check(s.isDefined("X1"), false);

    SimpleAttributeSet sParent = new SimpleAttributeSet();
View Full Code Here

    s.addAttributes(SimpleAttributeSet.EMPTY);
    harness.check(s.isEmpty());
   
    // try a set with no resolve parent and a couple of attributes
    SimpleAttributeSet atts1 = new SimpleAttributeSet();
    atts1.addAttribute("A1", "B1");
    atts1.addAttribute("A2", "B2");
    s.addAttributes(atts1);
    harness.check(s.getAttributeCount(), 2);
    harness.check(s.containsAttribute("A1", "B1"));
    harness.check(s.containsAttribute("A2", "B2"));
View Full Code Here

    harness.check(s.isEmpty());
   
    // try a set with no resolve parent and a couple of attributes
    SimpleAttributeSet atts1 = new SimpleAttributeSet();
    atts1.addAttribute("A1", "B1");
    atts1.addAttribute("A2", "B2");
    s.addAttributes(atts1);
    harness.check(s.getAttributeCount(), 2);
    harness.check(s.containsAttribute("A1", "B1"));
    harness.check(s.containsAttribute("A2", "B2"));
   
View Full Code Here

    harness.check(s.containsAttribute("A1", "B1"));
    harness.check(s.containsAttribute("A2", "B2"));
   
    // try a set with a resolve parent
    SimpleAttributeSet atts2 = new SimpleAttributeSet();
    atts2.addAttribute("C1", "D1");
    atts1.addAttribute("A1", "BB1");
    atts1.addAttribute("A2", "BB2");
    atts1.setResolveParent(atts2);
    s.addAttributes(atts1);
    harness.check(s.getResolveParent(), atts2);
View Full Code Here

  }

  public void testGetIntegerAttributeValue()
  {
    SimpleAttributeSet ase = new SimpleAttributeSet();
    ase.addAttribute(HTML.getAttributeKey("size"), "222");
    assertEquals(222,
                 HTML.getIntegerAttributeValue(ase,
                                               HTML.getAttributeKey("size"), 333
                                              )
                );
View Full Code Here

        int start = getSelectionStart();
        int end = getSelectionEnd();

        Element element = hdoc.getParagraphElement(start);
        MutableAttributeSet newAttrs = new SimpleAttributeSet(element.getAttributes());
        newAttrs.addAttribute(StyleConstants.NameAttribute, tag);

        hdoc.setParagraphAttributes(start, end - start, newAttrs, true);
    }

    /**
 
View Full Code Here

            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

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.