@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value="BC_UNCONFIRMED_CAST",justification="") @Override public void paint(final Graphics g){
  final Graphics2D g2d=(Graphics2D)g;
  g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  g2d.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
  g2d.setStroke(_stroke);
  Color bColor;
  if (_selected && _hasFocus) {
    bColor=getBackgroundSelectionColor();
  }
 else {
    bColor=getBackgroundNonSelectionColor();
    if (bColor == null) {
      bColor=getBackground();
    }
  }
  int imageOffset=-1;
  if (bColor != null) {
    imageOffset=getIconLabelStart();
    g2d.setColor(bColor);
    final Dimension size=getSize();
    g2d.fillRect(imageOffset,0,size.width - 1 - imageOffset,size.height);
  }
  if (_selected && _hasFocus) {
    if (_drawsFocusBorderAroundIcon) {
      imageOffset=0;
    }
 else     if (imageOffset == -1) {
      imageOffset=getIconLabelStart();
    }
    g2d.setColor(getBorderSelectionColor());
    g2d.drawRect(imageOffset,0,getWidth() - 1 - imageOffset,getHeight() - 1);
  }
 else   if (_selected) {
    g2d.setColor(getBorderSelectionColor());
    g2d.drawRect(imageOffset,0,getWidth() - 1 - imageOffset,getHeight() - 1);
  }
  paintChildren(g);
}

@ edu . umd . cs . findbugs . annotations . SuppressFBWarnings ( value = "BC_UNCONFIRMED_CAST" , justification = "" ) @ Override public void paint ( final Graphics g ) { final Graphics2D g2d = ( Graphics2D ) g ; g2d . setRenderingHint ( RenderingHints . KEY_TEXT_ANTIALIASING , RenderingHints . VALUE_TEXT_ANTIALIAS_ON ) ; g2d . setRenderingHint ( RenderingHints . KEY_RENDERING , RenderingHints . VALUE_RENDER_QUALITY ) ; g2d . setStroke ( _stroke ) ; Color bColor ; if ( _selected && _hasFocus ) { bColor = getBackgroundSelectionColor ( ) ; } else { bColor = getBackgroundNonSelectionColor ( ) ; if ( bColor == null ) { bColor = getBackground ( ) ; } } int imageOffset = - 1 ; if ( bColor != null ) { imageOffset = getIconLabelStart ( ) ; g2d . setColor ( bColor ) ; final Dimension size = getSize ( ) ; g2d . fillRect ( imageOffset , 0 , size . width - 1 - imageOffset , size . height ) ; } if ( _selected && _hasFocus ) { if ( _drawsFocusBorderAroundIcon ) { imageOffset = 0 ; } else if ( imageOffset == - 1 ) { imageOffset = getIconLabelStart ( ) ; } g2d . setColor ( getBorderSelectionColor ( ) ) ; g2d . drawRect ( imageOffset , 0 , getWidth ( ) - 1 - imageOffset , getHeight ( ) - 1 ) ; } else if ( _selected ) { g2d . setColor ( getBorderSelectionColor ( ) ) ; g2d . drawRect ( imageOffset , 0 , getWidth ( ) - 1 - imageOffset , getHeight ( ) - 1 ) ; } paintChildren ( g ) ; }
paints the value . the background is filled based on selected color .
