+ insets.bottom + margin.bottom);
+ insets.bottom);
  public static Dimension getPreferredButtonSize(AbstractButton b,                                                 int textIconGap)  {    Rectangle contentRect;    Rectangle viewRect;    Rectangle iconRect = new Rectangle();    Rectangle textRect = new Rectangle();    Insets insets = b.getInsets();    Insets margin = b.getMargin();        viewRect = new Rectangle();     /* java.awt.Toolkit.getFontMetrics is deprecated. However, it     * seems not obvious how to get to the correct FontMetrics object     * otherwise. The real problem probably is that the method     * javax.swing.SwingUtilities.layoutCompundLabel should take a     * LineMetrics, not a FontMetrics argument. But fixing this that     * would change the public API.     */    SwingUtilities.layoutCompoundLabel(      b, // for the component orientation      b.getToolkit().getFontMetrics(b.getFont()), // see comment above      b.getText(),      b.getIcon(),      b.getVerticalAlignment(),       b.getHorizontalAlignment(),      b.getVerticalTextPosition(),      b.getHorizontalTextPosition(),      viewRect, iconRect, textRect,      textIconGap);    /*  +------------------------+       +------------------------+     *  |                        |       |                        |     *  | ICON                   |       | CONTENTCONTENTCONTENT  |     *  |          TEXTTEXTTEXT  |  -->  | CONTENTCONTENTCONTENT  |     *  |          TEXTTEXTTEXT  |       | CONTENTCONTENTCONTENT  |     *  +------------------------+       +------------------------+     */    contentRect = textRect.union(iconRect);    return new Dimension(insets.left + margin.left			 + contentRect.width 			 + insets.right + margin.right,                         insets.top + margin.top			 + contentRect.height 			 + insets.bottom + margin.bottom);  }