Possible bug in JTable with AUTO_RESIZE_OFF

With the following setup of a JTable, when moving the rightmost column the column's data cells does't paint correctly:

column resize mode = AUTO_RESIZE_OFF

contained inside a scroll pane

total column width is smaller than the scroll pane view

This is easily reproducible with SwingSet2 /jdk/demo/jfc/SwingSet2, start up SwingSet2.jar. Switch to the JTable demo. Change the Autoresize mode to Off. Grab the Favorite Food column and move it slowly to the right. As you move the column, the cells will begin to disappear, but the title will still show correctly.

This seems to be a bug to me. I didn't find one already entered. What do y'all think?

[686 byte] By [jcullia] at [2007-11-27 11:14:10]
# 1

It could be considered a bug, but I realised that the painting done for the header is in a different region, ie Header Viewport and the painting of the cells is done in the region of the JTable.

The Cells are painted using the table width hence when moved out of the width of the table it disappears. The table header is however painted with the header viewport which stretches across the entire scrollpane.

This would be hard to fix IMHO but you could post it and see what response you get from the Swing Team.

ICE

icewalker2ga at 2007-7-29 14:05:23 > top of Java-index,Desktop,Core GUI APIs...
# 2

Yes, I agree that it matters how you look at it.

One way to "fix" it would be to not allow the dragging column's right edge to cross out of the jtable's area.

Another way would be to have the jtable's "background" area expand to fill the viewport. Something like JTable.setFillsViewPortHeight() but for the width. This way when dragging the columns around they would go outside the jtable only when they also go outside the scroll pane's viewport.

I'll submit it and see what happens.

jcullia at 2007-7-29 14:05:23 > top of Java-index,Desktop,Core GUI APIs...
# 3

I submitted this as a bug and it was accepted:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6584893

jcullia at 2007-7-29 14:05:23 > top of Java-index,Desktop,Core GUI APIs...
# 4

Well its got my vote

ICE

icewalker2ga at 2007-7-29 14:05:23 > top of Java-index,Desktop,Core GUI APIs...