views:

34

answers:

2

I have a JTable inside a JScrollPane. In one of the columns in the JTable, I have ImageIcons being displayed. Everything works fine, however, I have that in windows XP, when you scroll the rendering messes up and images become distorted.

This only happens when you scroll.

Screenshot: http://i.imgur.com/NKqYT.png

Any help much appreciated!

+1  A: 

Add an adjustment listener to your scroll bar and repaint the table on ajustment value changed events.

scrollBar=new JScrollPane(table);
scrollBar.getVerticalScrollBar().addAdjustmentListener(this);

public void adjustmentValueChanged(AdjustmentEvent e) {
    table.repaint();

    }
Emil
This worked. Except I had to repaint the table, not the scroll bar :)
whydna
I have changed the code.Please confirm if this is what you meant.
Emil
A: 

Images display fine on XP. Try out the example from UIManager Defaults. Click on "By Value Type" and then select "Icons" from the combo box.

camickr