JScrollPane ViewPort not repainting correctly
843804Jul 25 2002 — edited Jun 13 2005Hi,
I'm using two JScrollPanes, one above the other that I want to stay in lockstep horizontally by means of the user scrolling only the top pane's horizontal scroll bar, I do this with an event listener attached to the top horizontal scroll bar:
public void adjustmentValueChanged(AdjustmentEvent e) {
JViewport topViewport = this.headerPane.getViewport();
JViewport bottomViewport = this.stripsPane.getViewport();
bottomViewport.setViewPosition( topViewport.getViewPosition() );
}
This works fine... except the components do not repaint correctly in the bottom pane. The clipping region from the initial view seems to remain after a scroll, e.g. if one component is partially obscured before scrolling, the obscured section will still be clipped after the scroll. Fast scrolling causes blurring ghosting edges where components go in and out of view.
Any idea how to prevent this?
TIA Gareth.