void (JTable table) { JTable oldTable = getTable(); if (oldTable != null) { oldTable.removeMouseListener(myHeaderUI); oldTable.removeMouseMotionListener(myHeaderUI); } super.setTable(table); if (table != null) { table.addMouseListener(myHeaderUI); table.addMouseMotionListener(myHeaderUI); } }