FontMetrics fm = SwingUtilities.getFontMetrics(f);  Insets i = c.getInsets();  vr.x      = i.left; vr.y      = i.top; vr.width  = b.getWidth()  - (i.right  + vr.x); vr.height = b.getHeight() - (i.bottom + vr.y);
SwingUtilities.calculateInnerArea(b, br); SwingUtilities.calculateInsetArea(br, b.getMargin(), vr); String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f), b.getText(), currentIcon(b), b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), vr, ir, tr, defaultTextIconGap + defaultTextShiftOffset);  if ((b.getModel().isArmed() && b.getModel().isPressed()) || b.isSelected()) paintButtonPressed(g, br, c); else paintButtonNormal(g, br, c);
    public void paint(Graphics g, JComponent c)    {      	AbstractButton b = (AbstractButton) c;	Rectangle tr = new Rectangle();	Rectangle ir = new Rectangle();	Rectangle vr = new Rectangle();        Font f = c.getFont();        g.setFont(f);        FontMetrics fm = SwingUtilities.getFontMetrics(f);        Insets i = c.getInsets();        vr.x      = i.left;        vr.y      = i.top;        vr.width  = b.getWidth()  - (i.right  + vr.x);        vr.height = b.getHeight() - (i.bottom + vr.y);		//System.out.println("             VIEW-RECT-BUTTON="+vr+", insets="+i+", FONTM="+fm);		String text = SwingUtilities.layoutCompoundLabel(c,							 fm, 							 b.getText(),							 b.getIcon(),							 b.getVerticalAlignment(), 							 b.getHorizontalAlignment(),							 b.getVerticalTextPosition(), 							 b.getHorizontalTextPosition(),							 vr,							 ir,							 tr,							 gap);        if (b.getModel().isPressed() ||	    b.getModel().isSelected())	    {	      //System.out.println("paint pressed");		paintButtonPressed(g, c);	    }	else	    {	      //System.out.println("paint normal");		paintButtonNormal(g, c);	    }		paintIcon(g, c, ir);	paintText(g, c, tr, b.getText());	paintFocus(g, c, vr, tr, ir);    }