code: private String getTitle(String text, FontMetrics fm, int availTextWidth) {
          return SwingUtilities2.clipStringIfNecessary(rootPane, fm, text, availTextWidth);
      }
docs: Get the title text, clipped if necessary.
  
  @param  text           the title text.
  @param  fm             the font metrics to compute size with.
  @param  availTextWidth the available space to display the title in.
  
  @return the text, clipped to fit the available space.