code: protected void addCoordinateToGeometry(Coordinate newCoordinate) {
  		int length = geometry.getCoordinates().length;
  		Coordinate[] oldCoords = geometry.getCoordinates();
  		Coordinate[] newCoords = new Coordinate[length + 1];
  		System.arraycopy(oldCoords, 0, newCoords, 0, length);
  
  		// put new coordinate in right position
  		newCoords[length] = newCoordinate;
  
  		// create new geometry
  		geometry = factory.createLineString(newCoords);
  
  		// update drawing
  		updateTempLineAfterClick();
  	}
docs: -------------------------------------------------------------------------