@Override
    protected void paintComponent(Graphics g) {
      super.paintComponent(g);
      JViewport viewport = (JViewport)table.getParent();
      if (viewport != null && table.getWidth() < viewport.getWidth()) {
        int x = table.getWidth();
        int width = viewport.getWidth() - table.getWidth();
        paintHeader(g, getTable(), x, width);
      }
    }
@Override
    protected void paintComponent(Graphics g)