Polygon generatePolygon()
	 {
      if (lineUpperX.size() > 0)
      {	   
	     int[] xP = new int[2 * lineUpperX.size() + 1];
	     int[] yP = new int[2 * lineUpperY.size() + 1];
	     int i;
	     for(i=0; i < lineUpperX.size(); i++)
	     {
		    xP[i] = lineUpperX.get(i);
		    yP[i] = lineUpperY.get(i);       		
	     }
	     for(int j=i=lineBottomX.size() - 1; i >= 0; i--)
	     {
	        xP[j + lineBottomX.size() - i] = lineBottomX.get(i);
	        yP[j + lineBottomX.size() - i] = lineBottomY.get(i); 
	     }
	     xP[2 * lineUpperX.size()] = xP[0];
	     yP[2 * lineUpperX.size()] = yP[0];

	     return new Polygon(xP, yP, xP.length);
      }
      else return null;
	 }