protected void drawCylinder(int x,int y,int w,int h,Color fillColor,Paint fillPaint,Color penColor,boolean isShadow){
  int h4=h / 4;
  int r=w - 1;
  if (fillColor != null || fillPaint != null) {
    Area area=new Area(new Rectangle(x,y + h4 / 2,r,h - h4));
    area.add(new Area(new Rectangle(x,y + h4 / 2,r,h - h4)));
    area.add(new Area(new Ellipse2D.Double(x,y,r,h4)));
    area.add(new Area(new Ellipse2D.Double(x,y + h - h4,r,h4)));
    if (isShadow) {
      g.setColor(mxConstants.SHADOW_COLOR);
      g.translate(mxConstants.SHADOW_OFFSETX,mxConstants.SHADOW_OFFSETY);
      g.fill(area);
      g.translate(-mxConstants.SHADOW_OFFSETX,-mxConstants.SHADOW_OFFSETY);
    }
    if (fillPaint != null) {
      g.setPaint(fillPaint);
    }
 else {
      g.setColor(fillColor);
    }
    g.fill(area);
  }
  if (penColor != null) {
    g.setColor(penColor);
    int h2=h4 / 2;
    g.drawOval(x,y,r,h4);
    g.drawLine(x,y + h2,x,y + h - h2);
    g.drawLine(x + w - 1,y + h2,x + w - 1,y + h - h2);
    g.drawArc(x,y + h - h4,r,h4,0,-180);
  }
}

protected void drawCylinder ( int x , int y , int w , int h , Color fillColor , Paint fillPaint , Color penColor , boolean isShadow ) { int h4 = h / 4 ; int r = w - 1 ; if ( fillColor != null || fillPaint != null ) { Area area = new Area ( new Rectangle ( x , y + h4 / 2 , r , h - h4 ) ) ; area . add ( new Area ( new Rectangle ( x , y + h4 / 2 , r , h - h4 ) ) ) ; area . add ( new Area ( new Ellipse2D . Double ( x , y , r , h4 ) ) ) ; area . add ( new Area ( new Ellipse2D . Double ( x , y + h - h4 , r , h4 ) ) ) ; if ( isShadow ) { g . setColor ( mxConstants . SHADOW_COLOR ) ; g . translate ( mxConstants . SHADOW_OFFSETX , mxConstants . SHADOW_OFFSETY ) ; g . fill ( area ) ; g . translate ( - mxConstants . SHADOW_OFFSETX , - mxConstants . SHADOW_OFFSETY ) ; } if ( fillPaint != null ) { g . setPaint ( fillPaint ) ; } else { g . setColor ( fillColor ) ; } g . fill ( area ) ; } if ( penColor != null ) { g . setColor ( penColor ) ; int h2 = h4 / 2 ; g . drawOval ( x , y , r , h4 ) ; g . drawLine ( x , y + h2 , x , y + h - h2 ) ; g . drawLine ( x + w - 1 , y + h2 , x + w - 1 , y + h - h2 ) ; g . drawArc ( x , y + h - h4 , r , h4 , 0 , - 180 ) ; } }
draws a cylinder for the given parameters .
