We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › newbie : help with arraylist
Page Index Toggle Pages: 1
newbie : help with arraylist (Read 280 times)
newbie : help with arraylist
Nov 30th, 2008, 6:31pm
 
Hi, (escuse me for my awfull english)

i'm making an interface with points that can be link by lines. At first i used basic arrays like:

 points[] Linelist = new points[0];

and the lines were draw this way :

 for(int i = 1; i < Linelist.length; i=i+2) {
 line(Linelist[i - 1].x, Linelist[i - 1].y,Linelist[i].x, Linelist[i].y);

Actually, i have to change my program and use an Arraylist, but i don't know how to convert

 linelist[i].x

("linelist.get(i).x"doesn't work)

thanks !



Re: newbie : help with arraylist
Reply #1 - Nov 30th, 2008, 7:46pm
 
In Processing, currently you have to cast the objects taken out of an ArrayList:

points p = (points) linelist.get(i);
then use p.x and p.y
Re: newbie : help with arraylist
Reply #2 - Dec 1st, 2008, 1:09am
 
Cool !
it's works!

thanks a lot.
Page Index Toggle Pages: 1