Package java.text

Examples of java.text.BreakIterator.first()


                if(s.charAt((k + j) - 1) == '.')
                {
                    BreakIterator breakiterator1 = BreakIterator.getSentenceInstance();
                    breakiterator1.setText(s);
                    int l;
                    for(l = breakiterator1.first(); l != -1 && l < k + j; l = breakiterator1.next()) { }
                    if(l != k + j)
                    {
                        return getNextWordIndex(s, k + j);
                    }
                }
View Full Code Here


    wb.setText(text);
    int last = 0;

    int width = 0;

    for (int loc = wb.first(); loc != BreakIterator.DONE; loc = wb.next()) {
      String word = text.substring(last, loc);
      Point extent = gc.textExtent(word);
      width = Math.max(width, extent.x);
      last = loc;
    }
View Full Code Here

    int saved = 0;
    int last = 0;
    int height = lineHeight;
    int maxWidth = 0;

    for (int loc = wb.first(); loc != BreakIterator.DONE; loc = wb.next()) {
      String word = text.substring(saved, loc);
      Point extent = gc.textExtent(word);
      if (extent.x > wHint) {
        // overflow
        saved = last;
View Full Code Here

    int saved = 0;
    int last = 0;
    int y = bounds.y;
    int width = bounds.width;

    for (int loc = wb.first(); loc != BreakIterator.DONE; loc = wb.next()) {
      String line = text.substring(saved, loc);
      Point extent = gc.textExtent(line);

      if (extent.x > width) {
        // overflow
View Full Code Here

        BreakIterator boundary = BreakIterator.getLineInstance(locale);
        StringBuffer result = new StringBuffer(prefix1);

        boundary.setText(text);

        int start = boundary.first();
        int end = boundary.next();
        int lineLength = 0;

        while (end != BreakIterator.DONE) {
            String word = text.substring(start, end);
View Full Code Here

        bi.setText(txt);
        int lineHeight = fm.getHeight();
        int width = getSize().width;
        int penY = fm.getAscent();
        int lineStart = 0;
        int tempLineEnd = bi.first();
        int lineEnd = 0;
        int maxLineEnd = 0;
        totalHeight = 0;

        while (lineStart < txt.length()) {
View Full Code Here

        if (metrics.charsWidth(chars, 0, chars.length) > width)
        {
            BreakIterator iter = BreakIterator.getWordInstance();
            iter.setText(text);

            int start = iter.first();
            int end = start;
            int pos;

            while ( (pos = iter.next()) != BreakIterator.DONE )
            {
View Full Code Here

    boundary.setText(text);

    StringBuffer trial = new StringBuffer();
    StringBuffer real = new StringBuffer("<html>");

    int start = boundary.first();
    for (int end = boundary.next(); end != BreakIterator.DONE;
      start = end, end = boundary.next()) {
      String word = text.substring(start,end);
      trial.append(word);
      int trialWidth = SwingUtilities.computeStringWidth(fm,
View Full Code Here

    int start, end;
    ArrayList<String> sentenceList = new ArrayList<String>();
    //Uses default locale, change...
    BreakIterator breakIterator = BreakIterator.getSentenceInstance();
    breakIterator.setText(text);
    start = breakIterator.first();
    for (end = breakIterator.next(); end != BreakIterator.DONE;
        start = end, end = breakIterator.next()){
      sentenceList.add(text.substring(start, end));
    }
    return sentenceList; 
View Full Code Here

    this.commentText = rawCommentText.replaceAll("(?m)^\\s*\\*", ""); // todo precompile regex Patterns

    // Comment Summary using first sentence (Locale sensitive)
    BreakIterator boundary = BreakIterator.getSentenceInstance(Locale.getDefault()); // todo - allow locale to be passed in
        boundary.setText(commentText);
        int start = boundary.first();
        int end = boundary.next();
        if (start > -1 && end > -1) {
          // need to abbreviate this comment for the summary
          this.firstSentenceCommentText = commentText.substring(start,end);
        } else {
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.