JDK-6538743 : Dragging a Table Header causes JViewport reset
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-03-26
  • Updated: 2011-02-16
  • Resolved: 2007-03-28
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
place a jtable inside a jscrollpane, inside a jpanel. Ensure that the table is large enough to require horizontal scrolling.

Scroll to the right, attempt to drag a table header. The view will reset.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
place a jtable inside a jscrollpane, inside a jpanel. Ensure that the table is large enough to require horizontal scrolling.

Scroll to the right, attempt to drag a table header. The view will reset

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expected to be able to drag the column around without having the viewport reset itself and moving the entire table around under my scroll effort.
ACTUAL -
The minute a column position changes enough to require column reordering, the viewport resets. This is only apparent if you have scrolled the table horizontally away from position 0,0.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Nope.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

public class testjtable
{
	
	public static void main(String [] args)
	{
		JTable t = new JTable(new Object [][] { { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 } },
				  new Object [] { "A","B","C","D","E","F","G","H","I","J" });
		t.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
		JPanel p = new JPanel(new BorderLayout());
		p.add(new JScrollPane(t,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS),BorderLayout.CENTER);
		JFrame f = new JFrame();
		f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		f.getContentPane().setLayout(new BorderLayout());
		f.getContentPane().add(p,BorderLayout.CENTER);
		f.setSize(200,200);
		f.setVisible(true);
	}

}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
None, except to disable column reordering.

Release Regression From : 5.0u11
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION Duplicate of 6503981.
28-03-2007