Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.*;
- import java.awt.geom.*;
- import java.math.*;
- import java.lang.*;
- public class ForWhile extends Frame {
- public void paint(Graphics g) {
- Graphics2D graph = (Graphics2D)g;
- graph.setStroke(new BasicStroke(3.0f));
- graph.setColor(Color.black);
- Line2D line1 = new Line2D.Double( 110 , 0 , 110 , 510);
- Line2D line2 = new Line2D.Double( 190 , 0 , 190 , 510);
- graph.draw(line1);
- graph.draw(line2);
- for(int i = 1 ; i<=20 ; i++)
- {
- // graph.setColor(new Color((int)(Math.random()*255),(int)(Math.random()*255),(int)(Math.random()*255)));
- Line2D line = new Line2D.Double( 100 , i*25 , 200 , i*25);
- graph.draw(line);
- }
- }
- public static void main(String[] args) {
- Frame frame = new ForWhile();
- frame.addWindowListener(
- new WindowAdapter(){
- public void windowClosing(WindowEvent we){
- System.exit(0);
- }
- }
- );
- frame.setSize(1000, 1000);
- frame.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement