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.*;
- public class ForWhile extends Frame {
- //Line2D line = new Line2D.Double(40,0,40,300);
- int nPoints = 200;
- /*int xPoints[] = new int [100];
- int yPoints [] = new int [200];
- for(int d = 0 ; d<100 ; d++) {
- xPoints[d] = d;
- yPoints[d] = d;
- }
- Polygon p = new Polygon(xPoints, yPoints, nPoints);
- */
- public void paint(Graphics g) {
- Graphics2D graph = (Graphics2D)g;
- graph.setStroke(new BasicStroke(1.0f));
- graph.setPaint(Color.black);
- float j = 0;
- float k = 0;
- for(int i = 0 ; i < 10 ; i++) {
- j=j+10;
- k=k+5;
- Shape circle = new Ellipse2D.Float(250+k, 250+k, (110-j), (110-j));
- graph.draw((Shape) circle);
- }
- }
- /* int k = 0;
- for(int i = 10; i<500 ; i+=10) {
- // int k = 0;
- if(i % 3 == 0) {
- k=k+20;
- graph.setPaint(new Color(k,k,k));
- }
- Line2D line1 = new Line2D.Double(i,0,i,500);
- // Line2D line2 = new Line2D.Double(0,i,500,i);
- // graph.draw(p);
- graph.draw(line1);
- // graph.draw (line2);
- }
- */
- public static void main(String[] args) {
- Frame frame = new ForWhile();
- frame.addWindowListener(
- new WindowAdapter(){
- public void windowClosing(WindowEvent we){
- System.exit(0);
- }
- }
- );
- frame.setSize(500, 500);
- frame.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement