Problem with Line (Connecting and Loop)

i use this method to draw a line through some points:

public void connectBoxes(ColorRGBA colorUsed, String author) {
      MaterialState ms = DisplaySystem.getDisplaySystem().getRenderer().createMaterialState();
      int length = boxes.size();
      Vector3f[] vertex = new Vector3f[length];
      ColorRGBA[] color = new ColorRGBA[length];
      Vector3f center = new Vector3f();
       * only use boxes which are of a specific author
      System.out.println("Checking for: " + author);
      for (int i = 0; i < boxes.size(); i++) {
         if (authors.elementAt(i).equals(author) == true) {
      for (int j = 0; j < boxes2draw.size(); j++) {
         center = boxes2draw.elementAt(j).getCenter();
         vertex[j] = new Vector3f(center.x, center.y + boxes2draw.elementAt(j).yExtent, center.z);
         color[j] = ColorRGBA.white;
      Line connectingLine = new Line("Connecting Line", vertex, null, color, null);

event if the point (0,0,0) is not in the vertex list ( i checked it throug the system.out.println), the line always goes trhough the origin (0,0,0). does anybody know, how i can prevent that?

i tried to set the connecting mode to connected or loop but it doesn't matter.

thx 4 u help!

looks like it is possible for the vertex array to be longer than the boxes2draw array, which would likely leave some 0's at the end of the resulting FloatBuffer created in Line.  Try using an ArrayList for vertex and color instead.

thank you very mutch!! a big problem is solved!

i just moved the declaration further down and set the length of the arrays to boxes2draw.size()

that solves it.