void (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); } }