-
Bug
-
Resolution: Fixed
-
P4
-
1.2.2
-
beta
-
generic
-
generic
Name: skT88420 Date: 07/21/99
/*
Program to illustrate the Column-dragging bug.
Create a JTable with at least two columns. Make one column much
wider than the other. Drag the smaller column to reorder the
columns. As long as there is a partial overlap, the smaller
column will be visible. As soon as it overlaps completely, the
column that I'm dragging will disappear. It won't reappear until
I reach the point where there is only partial overlap.
This test program illustrates the problem. Run the program and
drag column A slowly over column B. Once the two columns overlap
completely, column A will vanish. It will reappear on either
side of B, as soon as the overlap is only a partial overlap.
*/
import javax.swing.*;
import javax.swing.table.*;
import java.awt.event.*;
public class DragBug
{
public static void main(String[] args)
{
JFrame mf = new JFrame("Column Dragging Bug");
WindowListener wl = new WindowAdapter()
{
public void windowClosing(WindowEvent evt) { System.exit(0); }
};
mf.addWindowListener(wl);
mf.setBounds(10, 10, 400, 400);
System.out.println("Java version " + System.getProperty("java.version"));
JTable theTable = new JTable(new DragBugModel());
theTable.getColumnModel().getColumn(0).setPreferredWidth(30);
theTable.getColumnModel().getColumn(1).setPreferredWidth(250);
JScrollPane scroller = new JScrollPane(theTable);
mf.getContentPane().add(scroller);
mf.show();
}
private static class DragBugModel extends AbstractTableModel
{
public int getRowCount() { return 3; }
public int getColumnCount() { return 2; }
public Object getValueAt(int row, int col) { return ""; }
DragBugModel() { super(); }
}
}
(Review ID: 88156)
======================================================================