Code example for AttributedString

Methods: addAttribute, getIterator

0
                3); 
        AttributedCharacterIterator it = as.getIterator(); 
        assertEquals("non-null value limit", 2, it 
                .getRunLimit(AttributedCharacterIterator.Attribute.LANGUAGE)); 
 
        as = new AttributedString("test"); 
        as.addAttribute(AttributedCharacterIterator.Attribute.LANGUAGE, null, 
                2, 3); 
        it = as.getIterator(); 
        assertEquals("null value limit", 4, it 
                .getRunLimit(AttributedCharacterIterator.Attribute.LANGUAGE)); 
 
        try { 
            as = new AttributedString("test"); 
            as.addAttribute(AttributedCharacterIterator.Attribute.LANGUAGE, 
                    null, -1, 3); 
            fail("Expected IllegalArgumentException"); 
        } catch (IllegalArgumentException e) { 
            // Expected 
        }