@Override public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2d = (Graphics2D) g;

    final Rectangle bounds = getBounds();
    final int paintedSize = 8;
    final int paintOffset = 7;

    RadContainer container = getSelectedGridContainer();
    if (container == null) {
      return;
    }
    RadAbstractGridLayoutManager layout = container.getGridLayoutManager();
    int[] coords = layout.getGridCellCoords(container, myIsRow);
    int[] sizes = layout.getGridCellSizes(container, myIsRow);
    int count = myIsRow ? layout.getGridRowCount(container) : layout.getGridColumnCount(container);

    for(int i=0; i<count; i++) {
      int x = myIsRow ? 0 : coords [i];
      int y = myIsRow ? coords [i] : 0;
      Point pnt = SwingUtilities.convertPoint(container.getDelegee(), x, y, this);

      Rectangle rc = myIsRow
                     ? new Rectangle(bounds.x+paintOffset, pnt.y, paintedSize, sizes [i])
                     : new Rectangle(pnt.x, bounds.y+paintOffset, sizes [i], paintedSize);

      g.setColor(getCaptionColor(i));
      g.fillRect(rc.x, rc.y, rc.width, rc.height);

      Rectangle rcDecoration = myIsRow
                               ? new Rectangle(bounds.x, pnt.y, bounds.width, sizes [i])
                               : new Rectangle(pnt.x, bounds.y, sizes [i], bounds.height);
      layout.paintCaptionDecoration(container, myIsRow, i, g2d, rcDecoration);

      Stroke oldStroke = g2d.getStroke();
      int deltaX = 0;
      int deltaY = 0;
      if (isFocusOwner() && i == mySelectionModel.getLeadSelectionIndex()) {
        g.setColor(Color.BLACK);
        g2d.setStroke(new BasicStroke(2.0f));
        deltaX = myIsRow ? 1 : 0;
        deltaY = myIsRow ? 0 : 1;
      }
      else {
        g.setColor(Color.DARK_GRAY);
      }
      g.drawRect(rc.x + deltaX, rc.y + deltaY, rc.width - deltaX, rc.height - deltaY);
      g2d.setStroke(oldStroke);
    }

    g.setColor(Color.DARK_GRAY);
    if (myIsRow) {
      g.drawLine(paintOffset+paintedSize, 0, paintOffset+paintedSize, bounds.height);
    }
    else {
      g.drawLine(0, paintOffset+paintedSize, bounds.width, paintOffset+paintedSize);
    }

    if (myDropInsertLine >= 0) {
      int[] lines = myIsRow ? layout.getHorizontalGridLines(container) : layout.getVerticalGridLines(container);
      int coord = lines [myDropInsertLine];
      if (myIsRow) {
        coord = SwingUtilities.convertPoint(container.getDelegee(), 0, coord, this).y;
      }
      else {
        coord = SwingUtilities.convertPoint(container.getDelegee(), coord, 0, this).x;
      }
      Stroke oldStroke = g2d.getStroke();
      g2d.setStroke(new BasicStroke(2.0f));
      g.setColor(PlatformColors.BLUE);
      if (myIsRow) {
        g.drawLine(bounds.x+1, coord, bounds.x+bounds.width-1, coord);
      }
      else {
        g.drawLine(coord, bounds.y+1, coord, bounds.y+bounds.height-1);
      }

      g2d.setStroke(oldStroke);
    }

  }
@Override public void paintComponent(Graphics g)