private void repaint(final RadContainer container) {
    final int width = container.getWidth();
    final int height = container.getHeight();

    if (width * height >= 4096*4096) return;
    Graphics2D g2d = (Graphics2D) myImage.getGraphics();
    try {
      g2d.setComposite(AlphaComposite.Clear);
      g2d.fillRect(0, 0, width, height);

      g2d.setComposite(AlphaComposite.Src);
      if (container.isSelected()) {
        g2d.setColor(Painter.SELECTED_GRID_COLOR);
      }
      else {
        g2d.setColor(Painter.NON_SELECTED_GRID_COLOR);
      }

      g2d.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, ourDashes, 0.0f));

      if (myHorzGridLines.length > 0) {
        int lastLine = (container.getDelegee().getHeight() - myHorzGridLines [myHorzGridLines.length-1] > 4)
                       ? myHorzGridLines.length
                       : myHorzGridLines.length-1;
        for (int i = 1; i < lastLine; i++) {
          final int y = myHorzGridLines [i];
          g2d.drawLine(0, y, width, y);
        }
      }

      if (myVertGridLines.length > 0) {
        // Vertical lines
        int lastLine = (container.getDelegee().getWidth() - myVertGridLines [myVertGridLines.length-1] > 4)
                       ? myVertGridLines.length
                       : myVertGridLines.length-1;
        for (int i = 1; i < lastLine; i++) {
          final int x = myVertGridLines [i];
          g2d.drawLine(x, 0, x, height);
        }
      }

      g2d.setComposite(AlphaComposite.Clear);
      g2d.setStroke(new BasicStroke(1.0f));
      for(RadComponent childComponent: container.getComponents()) {
        final GridConstraints constraints = childComponent.getConstraints();
        if (constraints.getColSpan() > 1) {
          for(int col = constraints.getColumn()+1; col < constraints.getColumn() + constraints.getColSpan(); col++) {
            drawVertGridLine(g2d, col, constraints.getRow(), constraints.getRowSpan());
          }

        }
        if (constraints.getRowSpan() > 1) {
          for(int row = constraints.getRow()+1; row < constraints.getRow() + constraints.getRowSpan(); row++) {
            drawHorzGridLine(g2d, row, constraints.getColumn(), constraints.getColSpan());
          }
        }
      }
    }
    finally {
      g2d.dispose();
    }
  }
private void repaint(final RadContainer container)