Package java.text

Examples of java.text.AttributedCharacterIterator.current()


  public void test1(TestHarness harness)
  {
    harness.checkPoint("getIterator()");
    AttributedString as = new AttributedString("ABC");
    AttributedCharacterIterator aci = as.getIterator();
    harness.check(aci.current() == 'A');
    harness.check(aci.next() == 'B');
    harness.check(aci.next() == 'C');
    harness.check(aci.next() == CharacterIterator.DONE);

    AttributedString as2 = new AttributedString("");
View Full Code Here


    harness.check(aci.next() == 'C');
    harness.check(aci.next() == CharacterIterator.DONE);

    AttributedString as2 = new AttributedString("");
    AttributedCharacterIterator aci2 = as2.getIterator();
    harness.check(aci2.current() == CharacterIterator.DONE);
  }

  public void test2(TestHarness harness)
  {
    harness.checkPoint("getIterator(AttributedCharacterIterator.Attribute[])");
View Full Code Here

    harness.check(aci.getAttribute(TextAttribute.FOREGROUND), null);
   
    // a null argument is equivalent to a regular iterator
    AttributedString as2 = new AttributedString("ABC");
    AttributedCharacterIterator aci2 = as2.getIterator(null);
    harness.check(aci2.current() == 'A');
    harness.check(aci2.next() == 'B');
    harness.check(aci2.next() == 'C');
    harness.check(aci2.next() == CharacterIterator.DONE);

    AttributedString as3 = new AttributedString("");
View Full Code Here

    harness.check(aci2.next() == 'C');
    harness.check(aci2.next() == CharacterIterator.DONE);

    AttributedString as3 = new AttributedString("");
    AttributedCharacterIterator aci3 = as3.getIterator(null);
    harness.check(aci3.current() == CharacterIterator.DONE);
  }
  public void test3(TestHarness harness)
  {
    harness.checkPoint("getIterator(AttributedCharacterIterator.Attribute[], int, int)");
View Full Code Here

    // as - Attributed string to attribute with Word extents.
    public static void findLineBrk(AttributedString as) {
        AttributedCharacterIterator aci = as.getIterator();
        if (aci.getEndIndex() == 0)
            return;
        char ch = aci.current(), prevCh = (char)-1;
        byte         cls = getCharCharClass(ch);
        byte      curCls = cls;
        byte     prevCls = cls;
        byte prevPrevCls = -1;
        int  wordCnt = 0;
View Full Code Here

        String brkStr = "";
        AttributedCharacterIterator aci = as.getIterator();
        AttributedCharacterIterator.Attribute WORD_LIMIT =
            TextLineBreaks.WORD_LIMIT;

        for (char ch = aci.current();
             ch!=AttributedCharacterIterator.DONE;
             ch = aci.next()) {
            chars  += ch + "  ";
            int w = ((Integer)aci.getAttribute(WORD_LIMIT)).intValue();
            if (w >=10)
View Full Code Here

        checkIterator(imr.getCommittedText(0, 14, null), 0, 0, 14);
        AttributedCharacterIterator it = imr.getCommittedText(0, 14, null);
        String committedText = "IM fitestfghij";
        for (int i = 0; i < 14; i++) {
            it.setIndex(i);
            assertEquals(committedText.charAt(i), it.current());
        }
        checkIterator(imr.getCommittedText(3, 8, null), 0, 0, 5);
        try {
            imr.getCommittedText(2, 20, null);
        } catch (IllegalArgumentException e) {
View Full Code Here

        StringBuffer brkStr = new StringBuffer();
        AttributedCharacterIterator aci = as.getIterator();
        AttributedCharacterIterator.Attribute WORD_LIMIT =
            TextLineBreaks.WORD_LIMIT;

        for (char ch = aci.current();
             ch!=AttributedCharacterIterator.DONE;
             ch = aci.next()) {

                chars.append( ch ).append( ' ' ).append( ' ' );
                int w = ((Integer)aci.getAttribute(WORD_LIMIT)).intValue();
View Full Code Here

    // as - Attributed string to attribute with Word extents.
    public static void findLineBrk(AttributedString as) {
        AttributedCharacterIterator aci = as.getIterator();
        if (aci.getEndIndex() == 0)
            return;
        char ch = aci.current(), prevCh = (char)-1;
        byte         cls = getCharCharClass(ch);
        if (cls == CHAR_CLASS_LF) cls = CHAR_CLASS_BK;
        byte      curCls = cls;
        byte     prevCls = cls;
        byte prevPrevCls = -1;
View Full Code Here

        String brkStr = "";
        AttributedCharacterIterator aci = as.getIterator();
        AttributedCharacterIterator.Attribute WORD_LIMIT =
            TextLineBreaks.WORD_LIMIT;

        for (char ch = aci.current();
             ch!=AttributedCharacterIterator.DONE;
             ch = aci.next()) {
            chars  += ch + "  ";
            int w = ((Integer)aci.getAttribute(WORD_LIMIT)).intValue();
            if (w >=10)
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.