Package javax.swing.text

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


    Vector v = new Vector();
    v.add("B");
    v.add("D");
    v.add("F");
    Enumeration e = v.elements();
    s.removeAttributes(e);
    harness.check(s.getAttributeCount(), 3);
    harness.check(s.getAttribute("A"), "1");
    harness.check(s.getAttribute("C"), "3");
    harness.check(s.getAttribute("E"), "5");
   
View Full Code Here


    try
      {
        v.clear();
        v.add(null);
        e = v.elements();
        s.removeAttributes(e);   
      }
      catch (NullPointerException ex)
      {
        pass = true;
      }
View Full Code Here

   
    // try a null enumeration
    pass = false;
    try
      {
        s.removeAttributes((Enumeration) null);   
      }
    catch (NullPointerException ex)
      {
        pass = true;
      }
View Full Code Here

    try
      {
        doc.insertString(0, "aaa", null);
        atts.addAttribute(StyleConstants.Underline, Boolean.TRUE);
        doc.insertString(3, "bbb", atts);
        atts.removeAttributes(atts);
        atts.addAttribute(StyleConstants.StrikeThrough, Boolean.TRUE);
        doc.insertString(6, "ccc", atts);
        atts.removeAttributes(atts);
        atts.addAttribute(StyleConstants.Underline, Boolean.TRUE);
        doc.insertString(5, "\nB", atts);
View Full Code Here

        atts.addAttribute(StyleConstants.Underline, Boolean.TRUE);
        doc.insertString(3, "bbb", atts);
        atts.removeAttributes(atts);
        atts.addAttribute(StyleConstants.StrikeThrough, Boolean.TRUE);
        doc.insertString(6, "ccc", atts);
        atts.removeAttributes(atts);
        atts.addAttribute(StyleConstants.Underline, Boolean.TRUE);
        doc.insertString(5, "\nB", atts);
      }
    catch (Exception ex)
      {
View Full Code Here

        Element root = doc.getDefaultRootElement();

        // Add strike trough text.
        atts.addAttribute(StyleConstants.StrikeThrough, Boolean.TRUE);
        doc.insertString(0, "Strike through text.\n", atts);
        atts.removeAttributes(atts);
        harness.checkPoint("after first insertion");
        harness.check(root.getElementCount(), 2);
        harness.check(root.getElement(0).getStartOffset(), 0);
        harness.check(root.getElement(0).getEndOffset(), 21);
        harness.check(root.getElement(1).getStartOffset(), 21);
View Full Code Here

        if (!keys.isUnderline() && !keys.isLineThrough()) {
            return super.removeAttributes(toModify, keys);
        }

        final MutableAttributeSet result = new SimpleAttributeSet(toModify);
        result.removeAttributes(keys);
        TextDecoration td =
            (TextDecoration)result.getAttribute(Attribute.TEXT_DECORATION);
        td = (TextDecoration)td.clone();

        if (keys.isUnderline() && td.isUnderline()) {
View Full Code Here

        if (!keys.isUnderline() && !keys.isLineThrough()) {
            return super.removeAttributes(toModify, keys);
        }

        final MutableAttributeSet result = new SimpleAttributeSet(toModify);
        result.removeAttributes(keys);
        TextDecoration td =
            (TextDecoration)result.getAttribute(Attribute.TEXT_DECORATION);
        td = (TextDecoration)td.clone();

        if (keys.isUnderline() && td.isUnderline()) {
View Full Code Here

        if (!keys.isUnderline() && !keys.isLineThrough()) {
            return super.removeAttributes(toModify, keys);
        }

        final MutableAttributeSet result = new SimpleAttributeSet(toModify);
        result.removeAttributes(keys);
        TextDecoration td =
            (TextDecoration)result.getAttribute(Attribute.TEXT_DECORATION);
        td = (TextDecoration)td.clone();

        if (keys.isUnderline() && td.isUnderline()) {
View Full Code Here

        if (!keys.isUnderline() && !keys.isLineThrough()) {
            return super.removeAttributes(toModify, keys);
        }

        final MutableAttributeSet result = new SimpleAttributeSet(toModify);
        result.removeAttributes(keys);
        TextDecoration td =
            (TextDecoration)result.getAttribute(Attribute.TEXT_DECORATION);
        td = (TextDecoration)td.clone();

        if (keys.isUnderline() && td.isUnderline()) {
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.