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 开发者_Go百科that in windows XP, when you scroll the rendering messes up and images become distorted.
This only happens when you scroll.
Screenshot: http://i.stack.imgur.com/NKqYT.png
Any help much appreciated!
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();
}
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.
精彩评论