/** * 绘制任务 */ protected static void drawTask(int x, int y, int width, int height, Graphics2D graphics) { RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, OFFSET_TASK, OFFSET_TASK); graphics.draw(rect); }
/** * 绘制子流程 */ protected static void drawSubProcess(int x, int y, int width, int height, Graphics2D graphics) { RoundRectangle2D rect = new RoundRectangle2D.Double(x + 1, y + 1, width - 2, height - 2, OFFSET_SUBPROCESS, OFFSET_SUBPROCESS); graphics.draw(rect); }
/** Constructor @param x x coord of upper left corner of fishbody if the fish were a rectangle @param y y coord of upper left corner of fishbody if the fish were a rectangle @param width width of the fish @param height of fish */ public Fish(double x, double y, double width, double height) { // Rather than having to scale at the end, we can just // draw things the right way to begin with, using the // x, y, width and height. If you haven't already // hard coded a particular drawing, this may be an easier // way. Ellipse2D.Double fishbody = new Ellipse2D.Double (x , y , width, height); Line2D.Double toptail = new Line2D.Double (x - width/4.0 , y , x , y + height/2.0); Line2D.Double middletail = new Line2D.Double ( x - width/4.0, y , x - width/4.0 , y + height); Line2D.Double bottomtail = new Line2D.Double ( x - width/4.0, y + height , x , y + height/2.0); Ellipse2D.Double fisheye = new Ellipse2D.Double(x + 0.70* width , y + height/3.0 , width / 8.0 , width/8.0); // put the whole fish together GeneralPath wholeFish = this.get(); wholeFish.append(fishbody, false); wholeFish.append(toptail, false); wholeFish.append(middletail, false); wholeFish.append(bottomtail, false); wholeFish.append(fisheye, false); }
@Override public Shape getBounds() { return EZElement.boundHelper(new Ellipse2D.Double(-circle.width / 2, -circle.height / 2, circle.width, circle.height), this); }
/** * 绘制任务 */ protected static void drawEvent(int x, int y, int width, int height, Graphics2D graphics) { Double circle = new Ellipse2D.Double(x, y, width, height); graphics.draw(circle); }
/** * Creates a circle with the given specifications. * While this constructor is available for usage, it is highly recommended that you do not use this. * Instead call EZ.addCircle() method which will perform additional background actions to get the circle to display * on the window properly. * * @param x center coordinate. * @param y center coordinate. * @param width of the circle. * @param height of the circle. * @param color to use when drawing. * @param filled status of whether the drawn circle should be a solid of the given color. */ public EZCircle(int x, int y, int width, int height, Color color, boolean filled) { circle = new Ellipse2D.Double(x - width / 2, y - height / 2, width, height); // transformCircle = new Ellipse2D.Double(-width/2,-height/2,width,height); this.color = color; this.filled = filled; xcd = x; ycd = y; }