I'm sure I'm making it painfully obvious I'm new to Java.
What I'm trying to use the ArrayList for is to keep track of dot objects in my applet. Dots are going to be created by the user with every click, which is why I needed to be able to add elements to it.
My problem now is that when I use the ArrayList.get(int index) method, I can't use that to access the object's variables. Here are some parts of my code...
public class MyPoint {
int x,y;
public MyPoint(int x1,int y1) {
x=x1;y=y1;
}
}
ArrayList points=new ArrayList();
public boolean mouseDown(Event e, int x, int y) {
points.add(new MyPoint(x,y));
return false;
}
public void paint(Graphics g) {
g.setColor(Color.black);
g.fillRect(0,0,windowWidth,windowHeight);
g.setColor(Color.blue);
for(int i=0;i<points.size();i++) {
g.fillOval(points.get(i).x,points.get(i).y,dotSize,dotSize);
}
}
In that last bit,
g.fillOval(points.get(i).x,points.get(i).y,dotSize,dotSize); cannot find x...
*Sigh* I know I'm new to Java, and I'm sure it's something simple I have wrong.