public static void main(String[] args) { DrawingTablet dt = new DrawingTablet(100, 100); DrawableCircle dc = new DrawableCircle(50, 50, 30); dc.setColor(Color.yellow); dt.drawShape(dc); DrawablePoint dp = new DrawablePoint(40, 50); dp.setColor(Color.red); dt.drawShape(dp); for (int i = 1; i <= 5; i++) { dp.translate(5, 0); dt.drawShape(dp); } DrawableString ds = new DrawableString(30, 45, "Testing."); dt.drawShape(ds); DrawableLine newLine = new DrawableLine(15, 16, 55, 60); newLine.setColor(Color.blue); dt.drawShape(newLine); DrawableRectangle newRect = new DrawableRectangle(30, 35, 25, 30); newRect.setColor(Color.green); dt.drawShape(newRect); DrawableRectangle newSqr = new DrawableRectangle(65, 70, 55, 55); newSqr.setColor(Color.pink); dt.drawShape(newSqr); dt.show(); }
/** * a main method to draw my picture * * @param args */ public static void main(String[] args) { DrawingTablet drawTablet = new DrawingTablet(100, 100); DrawableCircle drawCircle = new DrawableCircle(20, 20, 20); drawCircle.setColor(Color.yellow); drawTablet.drawShape(drawCircle); /*DrawablePoint dp = new DrawablePoint(40,50); dp.setColor(Color.red); dt.drawShape(dp); for (int i=1; i <=5; i++) { dp.translate(5,0); dt.drawShape(dp); }*/ DrawableString drawString = new DrawableString(30, 90, "My picture"); drawTablet.drawShape(drawString); /*DrawableLine newLine = new DrawableLine(15, 16, 55,60); newLine.setColor(Color.blue); dt.drawShape(newLine);*/ DrawableRectangle newRect = new DrawableRectangle(41, 50, 50, 25); newRect.setColor(Color.green); drawTablet.drawShape(newRect); DrawableRectangle newRectg = new DrawableRectangle(45, 55, 15, 20); newRectg.setColor(Color.pink); drawTablet.drawShape(newRectg); DrawableRectangle newSqr = new DrawableRectangle(65, 55, 15, 15); newSqr.setColor(Color.pink); drawTablet.drawShape(newSqr); DrawableLine newLine = new DrawableLine(85, 50, 95, 50); newLine.setColor(Color.blue); drawTablet.drawShape(newLine); for (int i = 1; i <= 25; i++) { newLine.translate(-1, -1); drawTablet.drawShape(newLine); } DrawableLine newLine1 = new DrawableLine(35, 50, 45, 50); newLine1.setColor(Color.blue); drawTablet.drawShape(newLine1); for (int i = 1; i <= 25; i++) { newLine1.translate(+1, -1); drawTablet.drawShape(newLine1); } drawTablet.show(); drawTablet.write("keyframe2.dat"); }