Point first = locationOf(selTile);  Rectangle area = new Rectangle(first); Stack stack = new Stack();  stack.push(new Point(first.x, first.y)); while (!stack.empty()) {  Point p = (Point)stack.pop();    if (contains(p.x, p.y) && getTileAt(p.x, p.y) == selTile) { area.add(p);  stack.push(new Point(p.x, p.y - 1)); stack.push(new Point(p.x, p.y + 1)); stack.push(new Point(p.x + 1, p.y)); stack.push(new Point(p.x - 1, p.y)); } }  return area;
return selRect;
	public Rectangle getSelectedArea() {				Point first = locationOf(selTile);				Rectangle area = new Rectangle(first); 		Stack stack = new Stack();		stack.push(new Point(first.x, first.y));		while (!stack.empty()) {			// Remove the next tile from the stack			Point p = (Point)stack.pop();			// If the tile it meets the requirements, set it and push its			// neighbouring tiles on the stack.			if (contains(p.x, p.y) &&					getTileAt(p.x, p.y) == selTile)			{				area.add(p);				stack.push(new Point(p.x, p.y - 1));				stack.push(new Point(p.x, p.y + 1));				stack.push(new Point(p.x + 1, p.y));				stack.push(new Point(p.x - 1, p.y));			}		}				return area;	}