private void drawBorder(Graphics2D g,int width,int height,Color color,float size){
  int max=(int)(Math.min((height - 2) * size,height / 2.0f) + 0.5);
  int alphaDelta=color.getAlpha() / max;
  for (int i=0; i < max; i++) {
    Shape s=shapeGenerator.createRoundRectangle(i,i,width - 2 * i - 1,height - 2 * i - 1,CornerSize.CHECKBOX_INTERIOR);
    Color newColor=new Color(color.getRed(),color.getGreen(),color.getBlue(),color.getAlpha() - i * alphaDelta);
    g.setPaint(newColor);
    g.draw(s);
  }
}

private void drawBorder ( Graphics2D g , int width , int height , Color color , float size ) { int max = ( int ) ( Math . min ( ( height - 2 ) * size , height / 2.0f ) + 0.5 ) ; int alphaDelta = color . getAlpha ( ) / max ; for ( int i = 0 ; i < max ; i ++ ) { Shape s = shapeGenerator . createRoundRectangle ( i , i , width - 2 * i - 1 , height - 2 * i - 1 , CornerSize . CHECKBOX_INTERIOR ) ; Color newColor = new Color ( color . getRed ( ) , color . getGreen ( ) , color . getBlue ( ) , color . getAlpha ( ) - i * alphaDelta ) ; g . setPaint ( newColor ) ; g . draw ( s ) ; } }
draw a border around the graphic .
