Example #1
0
  @Override
  public void draw(Graphics g, int index1, int index2) {
    // draw containers
    if (hasContainers(index1, index2)) {
      System.out.println("Has containers");

      Image buffer = _panel.createImage(_panel.getWidth() - 6, _panel.getHeight() / 2 - 6);
      Graphics2D bufferGraphics = (Graphics2D) buffer.getGraphics();
      bufferGraphics.setRenderingHint(
          RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

      bufferGraphics.setColor(Color.white);
      bufferGraphics.fillRect(0, 0, _panel.getWidth(), _panel.getHeight() / 2);
      drawContainers(bufferGraphics, index1, index2);
      BAR_GRAPH.addImage(buffer);
    }

    BAR_GRAPH.drawBuckets(true);
    BAR_GRAPH.draw(g, index1, index2);
    BAR_GRAPH.addImage(null);
  }