Package java.text

Examples of java.text.AttributedString.addAttributes()


            char c = stream.readChar();
            int start = 0;
            while (c != CharacterIterator.DONE) {
                int limit = stream.readInt();
                Map atts = (Map) stream.readObject();
                result.addAttributes(atts, start, limit);
                start = limit;
                c = stream.readChar();
            }
        }
        return result;
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
        this.aci.first();
        Float x = (Float) this.aci.getAttribute
            (GVTAttributedCharacterIterator.TextAttribute.X);
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
        this.aci.first();
        Float x = (Float) this.aci.getAttribute
            (GVTAttributedCharacterIterator.TextAttribute.X);
View Full Code Here

    int startPosition = 0;
    for (final StyledChunk chunk : styleChunks)
    {
      int length = chunk.getText().length();
      int endIndex = startPosition + length;
      str.addAttributes(chunk.getAttributes(), startPosition, endIndex);
      startPosition = endIndex;
    }
    return str;
  }
View Full Code Here

    harness.checkPoint("addAttributes(Map, int, int)");
    AttributedString as = new AttributedString("ABCDEFG");
    HashMap attributes = new HashMap();
    attributes.put(TextAttribute.BACKGROUND, Color.red);
    attributes.put(TextAttribute.FOREGROUND, Color.yellow);
    as.addAttributes(attributes, 2, 4);
    AttributedCharacterIterator aci = as.getIterator();
    aci.first();
    harness.check(aci.getRunStart(TextAttribute.BACKGROUND), 0);
    harness.check(aci.getRunLimit(TextAttribute.BACKGROUND), 2);
    aci.next();
View Full Code Here

    // check null map
    boolean pass = false;
    try
    {
      as.addAttributes(null, 2, 4);  
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
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.