@Override void paintPeer(final Graphics g){
  if (!disposed) {
    Dimension size=getPeerSize();
    g.setColor(getPeerBackground());
    g.fillRect(0,0,size.width,size.height);
    paintBorder(g,borderInsets.left,borderInsets.top,size.width - (borderInsets.left + borderInsets.right),size.height - (borderInsets.top + borderInsets.bottom));
    FontMetrics fm=g.getFontMetrics();
    Rectangle textRect, iconRect, viewRect;
    textRect=new Rectangle();
    viewRect=new Rectangle();
    iconRect=new Rectangle();
    viewRect.width=size.width - (contentAreaInsets.left + contentAreaInsets.right);
    viewRect.height=size.height - (contentAreaInsets.top + contentAreaInsets.bottom);
    viewRect.x=contentAreaInsets.left;
    viewRect.y=contentAreaInsets.top;
    String llabel=(label != null) ? label : "";
    String text=SwingUtilities.layoutCompoundLabel(fm,llabel,null,SwingConstants.CENTER,SwingConstants.CENTER,SwingConstants.CENTER,SwingConstants.CENTER,viewRect,iconRect,textRect,0);
    Font f=getPeerFont();
    g.setFont(f);
    if (pressed && armed) {
      paintButtonPressed(g,target);
    }
    paintText(g,target,textRect,text);
    if (hasFocus()) {
      paintFocus(g,focusInsets.left,focusInsets.top,size.width - (focusInsets.left + focusInsets.right) - 1,size.height - (focusInsets.top + focusInsets.bottom) - 1);
    }
  }
  flush();
}

@ Override void paintPeer ( final Graphics g ) { if ( ! disposed ) { Dimension size = getPeerSize ( ) ; g . setColor ( getPeerBackground ( ) ) ; g . fillRect ( 0 , 0 , size . width , size . height ) ; paintBorder ( g , borderInsets . left , borderInsets . top , size . width - ( borderInsets . left + borderInsets . right ) , size . height - ( borderInsets . top + borderInsets . bottom ) ) ; FontMetrics fm = g . getFontMetrics ( ) ; Rectangle textRect , iconRect , viewRect ; textRect = new Rectangle ( ) ; viewRect = new Rectangle ( ) ; iconRect = new Rectangle ( ) ; viewRect . width = size . width - ( contentAreaInsets . left + contentAreaInsets . right ) ; viewRect . height = size . height - ( contentAreaInsets . top + contentAreaInsets . bottom ) ; viewRect . x = contentAreaInsets . left ; viewRect . y = contentAreaInsets . top ; String llabel = ( label != null ) ? label : "" ; String text = SwingUtilities . layoutCompoundLabel ( fm , llabel , null , SwingConstants . CENTER , SwingConstants . CENTER , SwingConstants . CENTER , SwingConstants . CENTER , viewRect , iconRect , textRect , 0 ) ; Font f = getPeerFont ( ) ; g . setFont ( f ) ; if ( pressed && armed ) { paintButtonPressed ( g , target ) ; } paintText ( g , target , textRect , text ) ; if ( hasFocus ( ) ) { paintFocus ( g , focusInsets . left , focusInsets . top , size . width - ( focusInsets . left + focusInsets . right ) - 1 , size . height - ( focusInsets . top + focusInsets . bottom ) - 1 ) ; } } flush ( ) ; }
this method is called from toolkit thread and so it should not call any client code .
