Package java.text

Examples of java.text.BreakIterator.last()


        }
      }
    }

    // add the rest of the text, if there's any
    if (previous < iter.last()) {
      lines.add(text.getIterator(null, previous, iter.last()));
    }

    return lines;
  }
View Full Code Here


      }
    }

    // add the rest of the text, if there's any
    if (previous < iter.last()) {
      lines.add(text.getIterator(null, previous, iter.last()));
    }

    return lines;
  }
 
View Full Code Here

        int offset = s.offset;
        int index = Utilities.getTabbedTextOffset(s, fm, start, end, t, pos, false);
        int fullIndex = offset + index;
        BreakIterator bi = BreakIterator.getWordInstance();
        bi.setText(s);
        if (bi.last() <= fullIndex) {
            return bi.last() - offset;
        }
        if (bi.isBoundary(fullIndex)) {
            return Character.isWhitespace(s.array[fullIndex]) ? index + 1 : index;
        }
View Full Code Here

        int index = Utilities.getTabbedTextOffset(s, fm, start, end, t, pos, false);
        int fullIndex = offset + index;
        BreakIterator bi = BreakIterator.getWordInstance();
        bi.setText(s);
        if (bi.last() <= fullIndex) {
            return bi.last() - offset;
        }
        if (bi.isBoundary(fullIndex)) {
            return Character.isWhitespace(s.array[fullIndex]) ? index + 1 : index;
        }
        int prev = bi.preceding(fullIndex);
View Full Code Here

        for (int i = 0; i < length; i++) {
            int utilitiesWordStart = 0;
            if (i < length - 1) {
                iteratorWordStart = bi.preceding(i + 1);
            } else {
                bi.last();
                iteratorWordStart = bi.previous();
            }
            try {
                utilitiesWordStart = Utilities.getWordStart(c, i);
            } catch (BadLocationException e) {
View Full Code Here

        if (pos < 0 || pos > length) {
            throwException("No word at " + pos, pos);
        }
        String content = document.getText(0, length);
        bi.setText(content);
        return (pos < bi.last()) ? bi.following(pos) : pos;
    }

    private int getWordStart(final int pos) throws BadLocationException {
        BreakIterator bi = BreakIterator.getWordInstance();
        int length = document.getLength();
View Full Code Here

        bi.setText(content);
        int iteratorWordStart = pos;
        if (pos < length - 1) {
            iteratorWordStart = bi.preceding(pos + 1);
        } else {
            bi.last();
            iteratorWordStart = bi.previous();
        }
        return iteratorWordStart;
    }
View Full Code Here

                false);
        int fullIndex = offset +  index;

        BreakIterator bi = BreakIterator.getWordInstance();
        bi.setText(s);
        if (bi.last() <= fullIndex) {
            return bi.last() - offset;
        }
        if (bi.isBoundary(fullIndex)) {
            return Character.isWhitespace(s.array[fullIndex])
                   ? index + 1 : index;
View Full Code Here

        int fullIndex = offset +  index;

        BreakIterator bi = BreakIterator.getWordInstance();
        bi.setText(s);
        if (bi.last() <= fullIndex) {
            return bi.last() - offset;
        }
        if (bi.isBoundary(fullIndex)) {
            return Character.isWhitespace(s.array[fullIndex])
                   ? index + 1 : index;
        }
View Full Code Here

        if (pos < 0 || pos > length) {
            throwException("No word at " + pos, pos);
        }
        String content = doc.getText(0, doc.getLength());
        bi.setText(content);
        return (pos < bi.last()) ? bi.following(pos) : pos;
   }

   public static final int getWordStart(final TextKit tk, final int pos)
        throws BadLocationException {
        Document doc = tk.getDocument();
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.