The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
May 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Line2D.Float array???

Posted by Steve on May 22, 2000 at 12:31 AM

Hey guys/gals. I use the code segment below to draw the
horizontal lines in a grid. Can I make an array of Line2D.Float,
or should I use collections ?? I was thinking:
float[20] xOne; //used to hold x1 coords. in Line2D.Float
float[20] yOne; //y1 coords.
float[20] xTwo; //x2 coords.
float[20] yTwo; //y2 coords.
Then an array used to hold an Hln[20] object. One Hln
element could hold one element from each of the arrays above.
If possible, how do I go about this.
Once this is done, I was thinking to use a for LOOP to
draw the lines. Thanks, Steve

----------------
Line2D.Float Hln1 = new Line2D.Float(11F, 20F, 350F, 20F);
Line2D.Float Hln2 = new Line2D.Float(11F, 30F, 350F, 30F);
Line2D.Float Hln3 = new Line2D.Float(11F, 40F, 350F, 40F);
Line2D.Float Hln4 = new Line2D.Float(11F, 50F, 350F, 50F);
Line2D.Float Hln5 = new Line2D.Float(11F, 60F, 350F, 60F);
Line2D.Float Hln6 = new Line2D.Float(11F, 70F, 350F, 70F);
Line2D.Float Hln7 = new Line2D.Float(11F, 80F, 350F, 80F);
Line2D.Float Hln8 = new Line2D.Float(11F, 90F, 350F, 90F);
Line2D.Float Hln9 = new Line2D.Float(11F, 100F, 350F, 100F);
Line2D.Float Hln10 = new Line2D.Float(11F, 110F, 350F, 110F);
Line2D.Float Hln11 = new Line2D.Float(11F, 120F, 350F, 120F);
Line2D.Float Hln12 = new Line2D.Float(11F, 130F, 350F, 130F);
Line2D.Float Hln13 = new Line2D.Float(11F, 140F, 350F, 140F);
Line2D.Float Hln14 = new Line2D.Float(11F, 150F, 350F, 150F);
Line2D.Float Hln15 = new Line2D.Float(11F, 160F, 350F, 160F);
Line2D.Float Hln16 = new Line2D.Float(11F, 170F, 350F, 170F);
Line2D.Float Hln17 = new Line2D.Float(11F, 180F, 350F, 180F);
Line2D.Float Hln18 = new Line2D.Float(11F, 190F, 350F, 190F);
Line2D.Float Hln19 = new Line2D.Float(11F, 200F, 350F, 200F);
Line2D.Float Hln20 = new Line2D.Float(11F, 210F, 350F, 210F);

screen2D.draw(Hln1);
screen2D.draw(Hln2);
screen2D.draw(Hln3);
screen2D.draw(Hln4);
screen2D.draw(Hln5);
screen2D.draw(Hln6);
screen2D.draw(Hln7);
screen2D.draw(Hln8);
screen2D.draw(Hln9);
screen2D.draw(Hln10);
screen2D.draw(Hln11);
screen2D.draw(Hln12);
screen2D.draw(Hln13);
screen2D.draw(Hln14);
screen2D.draw(Hln15);
screen2D.draw(Hln16);
screen2D.draw(Hln17);
screen2D.draw(Hln18);
screen2D.draw(Hln19);
screen2D.draw(Hln20);



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us