Ejemplo n.º 1
0
  private void drawContainers(Graphics g, int index1, int index2) {
    // calculate dimensions and starting points for drawing
    steps.array.bucket.Container[] containers =
        ((Containers) _steps[index1][index2]).getContainers();
    int totalWidth = CONTAINER_SPACING;
    int totalHeight = 0;
    for (int i = 0; i < containers.length; i++) {
      totalWidth += getContainerDimensions(g, containers[i]).width + CONTAINER_SPACING;
      totalHeight = getContainerDimensions(g, containers[i]).height;
    }
    int x = (_panel.getWidth() - totalWidth) / 2, y = (_panel.getHeight() / 2 - totalHeight) / 2;

    // draw the containers
    g.setColor(Color.black);
    ContainerLocation[] locs = createLocations(g, containers);
    for (int i = 0; i < locs.length; i++) {
      if (containers[i].theValues.length > 0 && locs[i] != null)
        drawContainer(containers[i], g, locs[i].X, locs[i].Y);
    }
  }