Package java.text

Examples of java.text.BreakIterator.following()


        case AccessibleText.WORD:
            try {
                String s = unoObject.getText();
                BreakIterator words = BreakIterator.getWordInstance(getLocale(index));
                words.setText(s);
                int end = words.following(index);
                end = words.previous();
                int start = words.previous();
                if (start == BreakIterator.DONE) {
                    return null;
                }
View Full Code Here


            try {
                String s = unoObject.getText();
                BreakIterator sentence =
                    BreakIterator.getSentenceInstance(getLocale(index));
                sentence.setText(s);
                int end = sentence.following(index);
                end = sentence.previous();
                int start = sentence.previous();
                if (start == BreakIterator.DONE) {
                    return null;
                }
View Full Code Here

        case AccessibleText.WORD:
            try {
                String s = unoObject.getText();
                BreakIterator words = BreakIterator.getWordInstance(getLocale(index));
                words.setText(s);
                int end = words.following(index);
                return s.substring(words.previous(), end);
            } catch (IllegalArgumentException e) {
                return null;
            } catch (IndexOutOfBoundsException e) {
                return null;
View Full Code Here

            try {
                String s = unoObject.getText();
                BreakIterator sentence =
                    BreakIterator.getSentenceInstance(getLocale(index));
                sentence.setText(s);
                int end = sentence.following(index);
                return s.substring(sentence.previous(), end);
            } catch (IllegalArgumentException e) {
                return null;
            } catch (IndexOutOfBoundsException e) {
                return null;
View Full Code Here

    private String getLine(int index) {
        String result = null;
        BreakIterator bi = BreakIterator.getSentenceInstance();
        bi.setText(getText());
        int end = bi.following(index);
        int start = bi.preceding(end - 1);
        try {
            result = document.getText(start, end - start);
        } catch (BadLocationException e) {
            e.printStackTrace();
View Full Code Here

            // awt.2B=No word at {0}
            throwException(Messages.getString("awt.2B", pos), pos); //$NON-NLS-1$
        }
        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

        } catch (BadLocationException e) {
        }
        bi.first();
        for (int i = 0; i < length; i++) {
            int utilitiesWordEnd = 0;
            int iteratorWordEnd = bi.following(i);
            try {
                utilitiesWordEnd = Utilities.getWordEnd(c, i);
            } catch (BadLocationException e) {
            }
            assertEquals(iteratorWordEnd, utilitiesWordEnd);
View Full Code Here

        }
        assertNotNull(content);
        bi.first();
        for (int i = 0; i < length; i++) {
            int utilitiesNextWord = 0;
            int iteratorNextWord = bi.following(i);
            while (iteratorNextWord < length
                    && ((content.charAt(iteratorNextWord) == ' ' || content
                            .charAt(iteratorNextWord) == '\n') || content
                            .charAt(iteratorNextWord) == '\t')) {
                iteratorNextWord = bi.following(iteratorNextWord);
View Full Code Here

            int iteratorNextWord = bi.following(i);
            while (iteratorNextWord < length
                    && ((content.charAt(iteratorNextWord) == ' ' || content
                            .charAt(iteratorNextWord) == '\n') || content
                            .charAt(iteratorNextWord) == '\t')) {
                iteratorNextWord = bi.following(iteratorNextWord);
            }
            try {
                utilitiesNextWord = Utilities.getNextWord(c, i);
            } catch (BadLocationException e) {
            }
View Full Code Here

                        BreakIterator breakIterator = BreakIterator.getLineInstance();
                        breakIterator.setText(aci);

                        char c = text.charAt(lineBreakIndex);
                        if (Character.isWhitespace(c)) {
                            end = breakIterator.following(lineBreakIndex);
                        } else {
                            // Move back to the previous break
                            end = breakIterator.preceding(lineBreakIndex);

                            if (end <= start) {
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.