Advertisement
daniv1

IraLab2

May 8th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.*;
  3. import java.awt.geom.*;
  4. import java.math.*;
  5. import java.lang.*;
  6.  
  7. public class ForWhile extends Frame {
  8.    
  9.  
  10. public void paint(Graphics g) {
  11.     Graphics2D graph = (Graphics2D)g;
  12.       graph.setStroke(new BasicStroke(3.0f));
  13.       graph.setColor(Color.black);
  14.       Line2D line1 = new Line2D.Double( 110  , 0 , 110 , 510);
  15.       Line2D line2 = new Line2D.Double( 190  , 0 , 190 , 510);
  16.       graph.draw(line1);
  17.       graph.draw(line2);
  18.       for(int i = 1 ; i<=20 ; i++)
  19.       {
  20.     //    graph.setColor(new Color((int)(Math.random()*255),(int)(Math.random()*255),(int)(Math.random()*255)));
  21.          
  22.      Line2D line = new Line2D.Double( 100  ,  i*25 , 200 ,  i*25);
  23.      graph.draw(line);
  24.    
  25.        
  26.       }
  27.       }
  28.  
  29.    
  30.      
  31.  
  32.     public static void main(String[] args) {
  33.           Frame frame = new ForWhile();
  34.          
  35.           frame.addWindowListener(
  36.                   new WindowAdapter(){
  37.                       public void windowClosing(WindowEvent we){
  38.                       System.exit(0);
  39.                      }
  40.                     }
  41.                   );
  42.           frame.setSize(1000, 1000);
  43.           frame.setVisible(true);
  44.     }
  45.    
  46.    
  47.    
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement