Duplicate :
|
FULL PRODUCT VERSION : java version "1.6.0_14" Java(TM) SE Runtime Environment (build 1.6.0_14-b08) Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode, sharing) ADDITIONAL OS VERSION INFORMATION : not important A DESCRIPTION OF THE PROBLEM : run example and drag a column around just as you would do with a header attached to a table the other columns are not moved and on drop the dragged column is back at its original position STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : see above EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - see above ACTUAL - see above REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import javax.swing.JFrame; import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.table.JTableHeader; /** * Cannot move columns in standalone JTableHeader. * */ public class RegressionAfterFix6668281 { private static void createGui() { // just to quickly grab a column model JTable table = new JTable(10, 5); JTableHeader header = new JTableHeader(table.getColumnModel()); JFrame frame = new JFrame("standalone header"); frame.add(header); frame.pack(); frame.setVisible(true); } public static void main(String[] args) throws Exception { SwingUtilities.invokeLater(new Runnable() { public void run() { RegressionAfterFix6668281.createGui(); } }); } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : none outside of core header delegate. The culprit is the handler in BasicHeaderUI, method mouseDragged, line 35. It was introduced when fixing all those NPE's. Note that it is _not_ necessary to have a table for moving a column (as long as the header has a columnModel). It's conversion methods are only needed for managing the column selection (which is arguably ... ehem ... very dubious code in itself, but that's another story). So if you insist on the latter, do it separately from the column move. Okay, and I really think this is serious - it wrecks all applications which use the JTableHeader as a standalone component Cheers Jeanette Release Regression From : 5.0u17 The above release value was the last known release where this bug was not reproducible. Since then there has been a regression.