LineMetrics lineMetrics = font.getLineMetrics("ABC", SwingUtilities2.getFontRenderContext(this));
int fontHeight = Math.round(lineMetrics.getHeight());
setRowHeight(fontHeight + 2);
final JTableHeader tableHeader = getTableHeader();
if (!showHeader) {
tableHeader.setVisible(false);
tableHeader.setPreferredSize(new Dimension(-1, 0));
} else {
tableHeader.addMouseMotionListener(new MouseMotionAdapter() {
public void mouseDragged(MouseEvent e) {
scrollPane = UIUtil.getParentOfType(JBScrollPane.class, DBNTable.this);
if (scrollPane != null) {
calculateScrollDistance();
if (scrollDistance != 0 && scrollTimer == null) {
scrollTimer = new Timer();
scrollTimer.schedule(new ScrollTask(), 100, 100);
}
}
}
});
tableHeader.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
if (scrollTimer != null) {
scrollTimer.cancel();
scrollTimer.purge();