m.edgeSpacing.bottom += Math.max(m.textAscent - m.borderInsets.bottom, 0); m.borderSpacing.bottom += m.textDescent;
m.innerSpacing.bottom += Math.max(m.textAscent - m.lineHeight, 0); m.outerSpacing.bottom += m.textDescent + m.lineHeight;
  private Measurements getMeasurements(Component c)  {    Measurements m = new Measurements();    FontMetrics fmet;    m.font = getFont(c);    fmet = c.getFontMetrics(m.font);    m.border = getBorder();    if (m.border != null)      m.borderInsets = m.border.getBorderInsets(c);    else      m.borderInsets = new Insets(0, 0, 0, 0);    if (title != null)    {      m.trimmedText = title.trim();      if (m.trimmedText.length() == 0)        m.trimmedText = null;    }        m.textAscent = fmet.getAscent();    m.textDescent = fmet.getDescent();    FontRenderContext frc = new FontRenderContext(new AffineTransform(), false,                                                  false);    LineMetrics lmet = m.font.getLineMetrics(m.trimmedText, 0,                                             m.trimmedText.length(), frc);    m.lineHeight = (int) lmet.getStrikethroughOffset();    // Fallback in case that LineMetrics is not available/working.    if (m.lineHeight == 0)      m.lineHeight = (int) (0.3333 * (double) m.textAscent);    if (m.trimmedText != null)      m.textWidth = fmet.stringWidth(m.trimmedText) + 3;    m.edgeSpacing = new Insets(EDGE_SPACING, EDGE_SPACING, EDGE_SPACING, EDGE_SPACING);    m.borderSpacing = new Insets(0, 0, 0, 0);    switch (titlePosition)    {    case ABOVE_TOP:      m.borderSpacing.top += m.textAscent + m.textDescent + TEXT_SPACING;      break;    case BELOW_TOP:      m.edgeSpacing.top += m.textAscent + m.textDescent + TEXT_SPACING;      break;    case ABOVE_BOTTOM:      m.edgeSpacing.bottom += m.textAscent + m.textDescent + TEXT_SPACING;      break;    case BOTTOM:      m.edgeSpacing.bottom += Math.max(m.textAscent - m.borderInsets.bottom, 0);      m.borderSpacing.bottom += m.textDescent;      break;    case BELOW_BOTTOM:      m.borderSpacing.bottom += m.textAscent + m.textDescent + TEXT_SPACING;      break;    default:      m.borderSpacing.top += m.textAscent;    }    return m;  }