Why not have class like this
public class Points
{
private int xTopLeft;
private int yTopLeft;
private int xBottRight;
private int yBottRight;
public Points(){}
public Points(int a, int b, int c, int d)
{
setXTopLeft(a);
setYTopLeft(b);
setXBottRight(c);
setYBottRight(d);
}
private void setXTopLeft(int i){xTopLeft = i;}
public int getXTopLeft(){return xTopLeft;}
private void setYTopLeft(int i){yTopLeft = i;}
public int getYTopLeft() { return yTopLeft;}
private void setXBottRight(int i) {xBottRight = i;}
public int getXBottRight(){return xBottRight;}
private void setYBottRight(int i) {yBottRight = i;}
public int getYBottRight() { return yBottRight;}
}
with vector declaration as
Vector<Points> vec = new Vector<Points>(); and
//add new element to vector
vec.add(new Pointer(X_TOP_LEFT, Y_TOP_LEFT, X_BOTTOM_RIGHT, Y_BOTTOM_RIGHT));
//retrieve rectangle points
for(Vector<Pointers>point:vec)
{
//DO WHAT EVER YOU WANT WITH RETRIEVED DATA
System.out.println("Shape coordinates: "+point.getXTopLeft()+"-"+point.getYTopLeft()+"-"+point.getXBottRight()+"-"+point.getYBottRight());
}
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 871
Code tags enforcer
Offline 6,653 posts
since Dec 2004