code: protected List<Tuple<TextLayout,Rectangle2D>> computeLines (
          LineBreakMeasurer measurer, int targetWidth, Dimension size, boolean keepWordsWhole)
      {
          // start with a size of zero
          double width = 0, height = 0;
          List<Tuple<TextLayout,Rectangle2D>> layouts = new ArrayList<Tuple<TextLayout,Rectangle2D>>();
  
          try {
              // obtain our new dimensions by using a line break iterator to lay out our text one
              // line at a time
              TextLayout layout;
              int lastposition = _text.length();
              while (true) {
                  int nextret = _text.indexOf('\n', measurer.getPosition() + 1);
                  if (nextret == -1) {
                      nextret = lastposition;
                  }
                  layout = measurer.nextLayout(targetWidth, nextret, keepWordsWhole);
                  if (layout == null) {
                      break;
                  }
                  Rectangle2D bounds = getBounds(layout);
                  width = Math.max(width, getWidth(bounds));
                  height += getHeight(layout);
                  layouts.add(new Tuple<TextLayout,Rectangle2D>(layout, bounds));
              }
  
              // fill in the computed size; for some reason JDK1.3 on Linux chokes on
              // setSize(double,double)
              size.setSize(Math.ceil(width), Math.ceil(height));
  
              // this can only happen if keepWordsWhole is true
              if (measurer.getPosition() < lastposition) {
                  return null;
              }
  
          } catch (Throwable t) {
              log.warning("Label layout failed", "text", _text, t);
          }
  
          return layouts;
      }
docs: Computes the lines of text for this label given the specified target width. The overall size
  of the computed lines is stored into the <code>size</code> parameter.
  
  @return an {@link List} or null if <code>keepWordsWhole</code> was true and the lines could
  not be layed out in the target width.