Package java.text

Examples of java.text.AttributedString.addAttributes()


   
    // check negative beginIndex
    pass = false;
    try
    {
      as.addAttributes(attributes, -1, 4);  
    }
    catch (IllegalArgumentException e)
    {
      pass = true;  
    }
View Full Code Here


   
    // check endIndex > string length
    pass = false;
    try
    {
      as.addAttributes(attributes, 2, 8);  
    }
    catch (IllegalArgumentException e)
    {
      pass = true;  
    }
View Full Code Here

   
    // check indices with zero range
    pass = false;
    try
    {
      as.addAttributes(attributes, 2, 2);
    }
    catch (IllegalArgumentException e)
    {
      pass = true;  
    }
View Full Code Here

    int start = 0;
    while (c != CharacterIterator.DONE) {
        final int limit = stream.readInt();
        final Map<AttributedCharacterIterator.Attribute,Object> atts =
            (Map<AttributedCharacterIterator.Attribute,Object>) stream.readObject();
        result.addAttributes(atts, start, limit);
        start = limit;
        c = stream.readChar();
    }
    return result;
  }
View Full Code Here

            throw new IllegalArgumentException(Messages.getString("awt.02", "string")); //$NON-NLS-1$ //$NON-NLS-2$
        }
       
       
        AttributedString as = new AttributedString(string);
        as.addAttributes(attributes, 0, string.length());
        this.breaker = new TextRunBreaker(as.getIterator(), frc);
        caretManager = new CaretManager(breaker);
    }

    public TextLayout(AttributedCharacterIterator text, FontRenderContext frc) {
View Full Code Here

            }
            AttributedString reorderedAS = new AttributedString(reorderedString);
            for (int i = 0; i < numChars; i++) {
                aci.setIndex(charOrder[i]);
                Map attributes = aci.getAttributes();
                reorderedAS.addAttributes(attributes, i, i+1);
            }
            if (charOrder[0] == (aci.getBeginIndex()+1) && charOrder[1] == aci.getBeginIndex()) {
                // have swapped the first 2 chars, may need to move any position attributes

                aci.first();
View Full Code Here

                    if (value == null) continue;
                    destMap.put(key, value);
                }
                // System.out.println("Run: " + (index-start) + "->" +
                //                    (extent-start) + " of " + numChars);
                as.addAttributes (destMap, index-start, extent-start);
                index = extent;
            }
        }

        // We Just want it to do BIDI for us...
View Full Code Here

        Map prevAttrMap = attrs[newCharOrder[0]];
        for (int i = 1; i < numChars; i++) {
            Map attrMap = attrs[newCharOrder[i]];
            if (attrMap != prevAttrMap) {
                // Change in attrs set last run...
                reorderedAS.addAttributes(prevAttrMap, runStart, i);
                prevAttrMap = attrMap;
                runStart = i;
            }
        }
        reorderedAS.addAttributes(prevAttrMap, runStart, numChars);
View Full Code Here

                reorderedAS.addAttributes(prevAttrMap, runStart, i);
                prevAttrMap = attrMap;
                runStart = i;
            }
        }
        reorderedAS.addAttributes(prevAttrMap, runStart, numChars);

        // transfer any position atttributes to the new first char
        aci.first();
        Float x = (Float) aci.getAttribute
            (GVTAttributedCharacterIterator.TextAttribute.X);
View Full Code Here

        Iterator it = currentLineCache.iterator();
        int startCharIndex = 0;
        while (it.hasNext()) {
            LineCacheEntry entry = (LineCacheEntry)it.next();
            int endCharIndex = startCharIndex + entry.text.length();
            attrString.addAttributes(entry.attributes, startCharIndex, endCharIndex);
            startCharIndex = endCharIndex;
        }
        lines.add(attrString);
        textLines.add(text);
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.