Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- **
- * Write a description of class Project1 here.
- *
- * @author Kailey McNeal
- * @version 10-19-14
- * Project 1 p230
- */
- import java.awt.*;
- import java.applet.*;
- public class Project1 extends Applet
- {
- public void paint(Graphics g)
- {
- g.setColor(Color.cyan);
- g.fillRect(0,0,400,400);
- drawTile(g,0,0,1,100,5);
- drawTile(g,10,120,5,24,4);
- drawTile(g,150,20,6,40,5);
- drawTile(g,130,275,3,36,3);
- // drawTopl(g);
- // drawBotl(g);
- // drawTopr(g);
- // drawBotr(g);
- }
- public static void drawTile(Graphics g, int x, int y, int numoftiles, int sizeoftile, int numcircle)
- {
- // for(int i=0; i<numoftiles; i++)
- // {
- // for(int j=0; j<numoftiles; j++)
- // {
- // g.setColor(Color.green);
- // g.fillRect(x,y,sizeoftile,sizeoftile);
- // g.setColor(Color.black);
- // g.drawRect(x,y,sizeoftile,sizeoftile);
- // circle(g,x,y,sizeoftile,numoftiles,numcircle);
- // printCircle(g,x,y,sizeoftile, numcircle,sizeoftile);
- // }
- for(int i=0; i<numoftiles; i++)
- {
- for(int k=0; k<numoftiles; k++)
- {
- g.setColor(Color.green);
- g.fillRect(x,y,sizeoftile,sizeoftile);
- g.setColor(Color.black);
- g.drawRect(x,y,sizeoftile,sizeoftile);
- circle(g,x,y,sizeoftile,numoftiles,numcircle);
- printCircle(g,x,y,sizeoftile, numcircle,sizeoftile);
- x=x+sizeoftile;
- }
- x=x-sizeoftile*numoftiles;
- y=y+sizeoftile;
- }
- }
- public static void circle(Graphics g, int x, int y, int sizeoftile, int numofrows, int numcircle)
- {
- for (int i=0; i<=numofrows; i++)
- {
- printCircle(g,x,y,sizeoftile,numcircle,sizeoftile);
- }
- }
- public static void printCircle(Graphics g, int x, int y, int circlesize, int numcircle, int sizeoftile)
- {
- for(int i=0; i<numcircle; i++)
- {
- g.setColor(Color.yellow);
- g.fillOval(x+i*circlesize/numcircle/2,y+i*circlesize/numcircle/2,circlesize-i*circlesize/numcircle,circlesize-i*circlesize/numcircle);
- }
- for(int i=0; i<numcircle; i++)
- {
- g.setColor(Color.black);
- g.drawOval(x+i*circlesize/numcircle/2,y+i*circlesize/numcircle/2,circlesize-i*circlesize/numcircle,circlesize-i*circlesize/numcircle);
- }
- g.setColor(Color.black);
- g.drawLine(x+sizeoftile/2,y,x+sizeoftile/2,y+sizeoftile);
- g.drawLine(x,y+sizeoftile/2,x+sizeoftile,y+sizeoftile/2);
- // public static void drawTopl(Graphics g)
- // {
- //
- //
- //
- //
- //
- // // g.setColor(Color.green);
- // // g.fillRect(0,0,100,100);
- // // g.setColor(Color.black);
- // // g.drawRect(0,0,100,100);
- // //
- // // g.setColor(Color.yellow);
- // // g.fillOval(0,0,100,100);
- // // g.setColor(Color.black);
- // // g.drawOval(0,0,100,100);
- // //
- // // g.setColor(Color.yellow);
- // // g.fillOval(10,10,80,80);
- // // g.setColor(Color.black);
- // // g.drawOval(10,10,80,80);
- // //
- // // g.setColor(Color.yellow);
- // // g.fillOval(20,20,60,60);
- // // g.setColor(Color.black);
- // // g.drawOval(20,20,60,60);
- // //
- // // g.setColor(Color.yellow);
- // // g.fillOval(30,30,40,40);
- // // g.setColor(Color.black);
- // // g.drawOval(30,30,40,40);
- // //
- // // g.setColor(Color.yellow);
- // // g.fillOval(40,40,20,20);
- // // g.setColor(Color.black);
- // // g.drawOval(40,40,20,20);
- // //
- // // g.drawLine(50,0,50,100);
- // // g.drawLine(0,50,100,50);
- // }
- // public static void drawBotl(Graphics g)
- // {
- // for (int j=0; j<=4;j++)
- // {
- // int x=(10+24*j);
- // int y=120;
- // int size=24;
- // g.setColor(Color.green);
- // g.fillRect(x,y,size,size);
- // g.setColor(Color.black);
- // g.drawRect(x,y,size,size);
- //
- // for(int i=0; i<=4; i++)
- // {
- //
- // x=x-i*3;
- // y=y-i*3;
- //
- //
- // //1 circle
- // g.setColor(Color.yellow);
- // g.fillOval(x,y,size,size);
- // g.setColor(Color.black);
- // g.drawOval(x,y,size,size);
- // g.drawLine(x+size/2,y,x+size/2, y+size);
- // }
- // // for (int i=0; i<=3;i++)
- // // {
- // //
- // //
- // // g.setColor(Color.green);
- // // g.fillRect(34,120,24,24);
- // // g.setColor(Color.black);
- // // g.drawRect(34,120,24,24);
- // // //1 circle
- // // g.setColor(Color.yellow);
- // // g.fillOval(34,120,24,24);
- // // g.setColor(Color.black);
- // // g.drawOval(34,120,24,24);
- // //
- // // g.setColor(Color.yellow);
- // // g.fillOval(31,117,18,18);
- // // g.setColor(Color.black);
- // // g.drawOval(31,117,18,18);
- // //
- // // g.setColor(Color.yellow);
- // // g.fillOval(28,114,12,12);
- // // g.setColor(Color.black);
- // // g.drawOval(28,114,12,12);
- // //
- // // g.setColor(Color.yellow);
- // // g.fillOval(25,111,6,6);
- // // g.setColor(Color.black);
- // // g.drawOval(25,111,6,6);
- // // g.drawLine(36,0,48,24);
- // // g.drawLine(24,12,48,12);
- // //
- // //
- // //
- // //
- // // g.setColor(Color.green);
- // // g.fillRect(58,120,24,24);
- // // g.setColor(Color.black);
- // // g.drawRect(58,120,24,24);
- // // //1 circle
- // // g.setColor(Color.yellow);
- // // g.fillOval(58,120,24,24);
- // // g.setColor(Color.black);
- // // g.drawOval(58,120,24,24);
- // //
- // // g.setColor(Color.yellow);
- // // g.fillOval(55,117,18,18);
- // // g.setColor(Color.black);
- // // g.drawOval(55,117,18,18);
- // //
- // // g.setColor(Color.yellow);
- // // g.fillOval(52,114,12,12);
- // // g.setColor(Color.black);
- // // g.drawOval(52,114,12,12);
- // //
- // // g.setColor(Color.yellow);
- // // g.fillOval(49,111,6,6);
- // // g.setColor(Color.black);
- // // g.drawOval(49,111,6,6);
- // // g.drawLine(60,0,72,24);
- // // g.drawLine(48,12,72,12);
- // //
- // //
- // //
- // // g.setColor(Color.green);
- // // g.fillRect(82,120,24,24);
- // // g.setColor(Color.black);
- // // g.drawRect(82,120,24,24);
- // // //1 circle
- // // g.setColor(Color.yellow);
- // // g.fillOval(82,120,24,24);
- // // g.setColor(Color.black);
- // // g.drawOval(58,120,24,24);
- // //
- // // g.setColor(Color.yellow);
- // // g.fillOval(55,117,18,18);
- // // g.setColor(Color.black);
- // // g.drawOval(55,117,18,18);
- // //
- // // g.setColor(Color.yellow);
- // // g.fillOval(52,114,12,12);
- // // g.setColor(Color.black);
- // // g.drawOval(52,114,12,12);
- // //
- // // g.setColor(Color.yellow);
- // // g.fillOval(49,111,6,6);
- // // g.setColor(Color.black);
- // // g.drawOval(49,111,6,6);
- // // g.drawLine(60,0,72,24);
- // // g.drawLine(48,12,72,12);
- // //
- // //
- // // }
- //
- //
- // }
- // }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement