private Paint areaFillPaintFactory(FillStyle style,Color color){
  if (areaFillStyle == FillStyle.NONE) {
    return new Color(0,0,0,0);
  }
 else   if (areaFillStyle == FillStyle.SOLID) {
    return color;
  }
 else {
    final int s=10;
    BufferedImage bufferedImage=new BufferedImage(s,s,BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2=bufferedImage.createGraphics();
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setColor(color);
    g2.setStroke(new BasicStroke(s / 10.0f,BasicStroke.CAP_SQUARE,BasicStroke.JOIN_MITER));
    if (areaFillStyle == FillStyle.FALLING_HATCHED) {
      g2.drawLine(0,0,s,s);
      g2.drawLine(0,-s,2 * s,s);
      g2.drawLine(-s,0,s,2 * s);
    }
 else     if (areaFillStyle == FillStyle.RISING_HATCHED) {
      g2.drawLine(0,s,s,0);
      g2.drawLine(-s,s,s,-s);
      g2.drawLine(0,2 * s,2 * s,0);
    }
 else     if (areaFillStyle == FillStyle.CROSS_HATCHED) {
      g2.drawLine(0,s,s,0);
      g2.drawLine(0,0,s,s);
    }
 else     if (areaFillStyle == FillStyle.HORIZONTALLY_HATCHED) {
      g2.drawLine(0,s / 4,s,s / 4);
      g2.drawLine(0,3 * s / 4,s,3 * s / 4);
    }
 else     if (areaFillStyle == FillStyle.VERTICALLY_HATCHED) {
      g2.drawLine(s / 4,0,s / 4,s);
      g2.drawLine(3 * s / 4,0,3 * s / 4,s);
    }
 else {
      throw new RuntimeException("Illegal area fill style: " + areaFillStyle + ". This cannot happen");
    }
    Rectangle2D rect=new Rectangle2D.Double(0,0,s,s);
    TexturePaint texturePaint=new TexturePaint(bufferedImage,rect);
    return texturePaint;
  }
}

private Paint areaFillPaintFactory ( FillStyle style , Color color ) { if ( areaFillStyle == FillStyle . NONE ) { return new Color ( 0 , 0 , 0 , 0 ) ; } else if ( areaFillStyle == FillStyle . SOLID ) { return color ; } else { final int s = 10 ; BufferedImage bufferedImage = new BufferedImage ( s , s , BufferedImage . TYPE_INT_ARGB ) ; Graphics2D g2 = bufferedImage . createGraphics ( ) ; g2 . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ; g2 . setColor ( color ) ; g2 . setStroke ( new BasicStroke ( s / 10.0f , BasicStroke . CAP_SQUARE , BasicStroke . JOIN_MITER ) ) ; if ( areaFillStyle == FillStyle . FALLING_HATCHED ) { g2 . drawLine ( 0 , 0 , s , s ) ; g2 . drawLine ( 0 , - s , 2 * s , s ) ; g2 . drawLine ( - s , 0 , s , 2 * s ) ; } else if ( areaFillStyle == FillStyle . RISING_HATCHED ) { g2 . drawLine ( 0 , s , s , 0 ) ; g2 . drawLine ( - s , s , s , - s ) ; g2 . drawLine ( 0 , 2 * s , 2 * s , 0 ) ; } else if ( areaFillStyle == FillStyle . CROSS_HATCHED ) { g2 . drawLine ( 0 , s , s , 0 ) ; g2 . drawLine ( 0 , 0 , s , s ) ; } else if ( areaFillStyle == FillStyle . HORIZONTALLY_HATCHED ) { g2 . drawLine ( 0 , s / 4 , s , s / 4 ) ; g2 . drawLine ( 0 , 3 * s / 4 , s , 3 * s / 4 ) ; } else if ( areaFillStyle == FillStyle . VERTICALLY_HATCHED ) { g2 . drawLine ( s / 4 , 0 , s / 4 , s ) ; g2 . drawLine ( 3 * s / 4 , 0 , 3 * s / 4 , s ) ; } else { throw new RuntimeException ( "Illegal area fill style: " + areaFillStyle + ". This cannot happen" ) ; } Rectangle2D rect = new Rectangle2D . Double ( 0 , 0 , s , s ) ; TexturePaint texturePaint = new TexturePaint ( bufferedImage , rect ) ; return texturePaint ; } }
creates a paint with the given fillstyle , opacity and the color returned by getitemcolor ( ) .
