protected double findMaximumTickLabelWidth(List ticks,Graphics2D g2,Rectangle2D drawArea,boolean vertical){
  RectangleInsets insets=getTickLabelInsets();
  Font font=getTickLabelFont();
  double maxWidth=0.0;
  if (!vertical) {
    FontMetrics fm=g2.getFontMetrics(font);
    Iterator iterator=ticks.iterator();
    while (iterator.hasNext()) {
      Tick tick=(Tick)iterator.next();
      Rectangle2D labelBounds=null;
      if (tick instanceof LogTick) {
        LogTick lt=(LogTick)tick;
        if (lt.getAttributedLabel() != null) {
          labelBounds=AttrStringUtils.getTextBounds(lt.getAttributedLabel(),g2);
        }
      }
 else       if (tick.getText() != null) {
        labelBounds=TextUtilities.getTextBounds(tick.getText(),g2,fm);
      }
      if (labelBounds != null && labelBounds.getWidth() + insets.getLeft() + insets.getRight() > maxWidth) {
        maxWidth=labelBounds.getWidth() + insets.getLeft() + insets.getRight();
      }
    }
  }
 else {
    LineMetrics metrics=font.getLineMetrics("ABCxyz",g2.getFontRenderContext());
    maxWidth=metrics.getHeight() + insets.getTop() + insets.getBottom();
  }
  return maxWidth;
}

protected double findMaximumTickLabelWidth ( List ticks , Graphics2D g2 , Rectangle2D drawArea , boolean vertical ) { RectangleInsets insets = getTickLabelInsets ( ) ; Font font = getTickLabelFont ( ) ; double maxWidth = 0.0 ; if ( ! vertical ) { FontMetrics fm = g2 . getFontMetrics ( font ) ; Iterator iterator = ticks . iterator ( ) ; while ( iterator . hasNext ( ) ) { Tick tick = ( Tick ) iterator . next ( ) ; Rectangle2D labelBounds = null ; if ( tick instanceof LogTick ) { LogTick lt = ( LogTick ) tick ; if ( lt . getAttributedLabel ( ) != null ) { labelBounds = AttrStringUtils . getTextBounds ( lt . getAttributedLabel ( ) , g2 ) ; } } else if ( tick . getText ( ) != null ) { labelBounds = TextUtilities . getTextBounds ( tick . getText ( ) , g2 , fm ) ; } if ( labelBounds != null && labelBounds . getWidth ( ) + insets . getLeft ( ) + insets . getRight ( ) > maxWidth ) { maxWidth = labelBounds . getWidth ( ) + insets . getLeft ( ) + insets . getRight ( ) ; } } } else { LineMetrics metrics = font . getLineMetrics ( "ABCxyz" , g2 . getFontRenderContext ( ) ) ; maxWidth = metrics . getHeight ( ) + insets . getTop ( ) + insets . getBottom ( ) ; } return maxWidth ; }
a utility method for determining the width of the widest tick label .
