Advertisement
daniv1

Untitled

Mar 13th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.55 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.*;
  3. import java.awt.geom.*;
  4.  
  5.  
  6.  
  7. public class ForWhile extends Frame {
  8.     //Line2D line = new Line2D.Double(40,0,40,300);
  9.    
  10.   int nPoints = 200;
  11.     /*int xPoints[] = new int [100];
  12.     int yPoints [] = new int [200];
  13.     for(int d = 0 ; d<100 ; d++) {
  14.         xPoints[d] = d;
  15.         yPoints[d] = d;
  16.     }
  17.     Polygon p = new Polygon(xPoints, yPoints, nPoints);
  18.    
  19. */
  20. public void paint(Graphics g) {
  21.       Graphics2D graph = (Graphics2D)g;
  22.       graph.setStroke(new BasicStroke(1.0f));
  23.     graph.setPaint(Color.black);
  24.  
  25.     float j = 0;
  26.     float k = 0;
  27. for(int i = 0 ; i < 10 ; i++) {
  28.     j=j+10;
  29.     k=k+5;
  30.     Shape circle = new Ellipse2D.Float(250+k, 250+k, (110-j), (110-j));
  31.     graph.draw((Shape) circle);
  32.  
  33.     }
  34. }
  35.     /*  int k = 0;
  36.       for(int i = 10; i<500 ; i+=10) {
  37.          // int k = 0;
  38.           if(i % 3 == 0) {
  39.             k=k+20;
  40.               graph.setPaint(new Color(k,k,k));
  41.           }
  42.           Line2D line1 = new Line2D.Double(i,0,i,500);
  43.          // Line2D line2 = new Line2D.Double(0,i,500,i);
  44.         //  graph.draw(p);
  45.          graph.draw(line1);
  46.          // graph.draw (line2);
  47.       }
  48.      */
  49.    
  50.    
  51.    
  52.    
  53.    
  54.    
  55.    
  56.    
  57.    
  58.    
  59.    
  60.    
  61.    
  62.    
  63.    
  64.    
  65.    
  66.    
  67.    
  68.    
  69.    
  70.    
  71.    
  72.    
  73.    
  74.    
  75.    
  76.    
  77.  
  78.     public static void main(String[] args) {
  79.           Frame frame = new ForWhile();
  80.          
  81.           frame.addWindowListener(
  82.                   new WindowAdapter(){
  83.                       public void windowClosing(WindowEvent we){
  84.                       System.exit(0);
  85.                      }
  86.                     }
  87.                   );
  88.           frame.setSize(500, 500);
  89.           frame.setVisible(true);
  90.     }
  91.    
  92.    
  93.    
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement