Package java.text

Examples of java.text.BreakIterator.preceding()


        end = it.preceding(index);
      // Make sure there was a complete unit.  I.e. if index is in the middle
      // of a word, return null if there is no word before that one.
      if (end == -1)
        return null;
      int start = it.preceding(end);
      if (start == -1)
        return text.substring(0, end);
      else
        return text.substring(start, end);
    }
View Full Code Here


        }
        else if (p1 + 1 == parent1) {
            // assert(s.count > 1)
            breakPoint = breaker.following(s.offset + s.count - 2);
            if (breakPoint >= s.count + s.offset) {
                breakPoint = breaker.preceding(s.offset + s.count - 1);
            }
        }
        else {
            breakPoint = breaker.preceding(p1 - parent0 + s.offset + 1);
        }
View Full Code Here

            if (breakPoint >= s.count + s.offset) {
                breakPoint = breaker.preceding(s.offset + s.count - 1);
            }
        }
        else {
            breakPoint = breaker.preceding(p1 - parent0 + s.offset + 1);
        }

        int retValue = -1;

        if (breakPoint != BreakIterator.DONE) {
View Full Code Here

                        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) {
                                // The whole word doesn't fit in the given space
                                if (breakOnWhitespaceOnly) {
                                    // Move forward to the next break
View Full Code Here

                        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) {
                                // The whole word doesn't fit in the given space
                                if (breakOnWhitespaceOnly) {
                                    // Move forward to the next break
View Full Code Here

            return;
        }

        BreakIterator wordBreakIterator = BreakIterator.getWordInstance();
        wordBreakIterator.setText(getText());
        wordBreakIterator.preceding(getCaretPosition());
        wordBreakIterator.previous();

        moveTo(wordBreakIterator.current(), selectionPolicy);
    }
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.