I have a routine that draws an insanely large graph inside the scroll bar. It is too big to draw before adding to scrollpane - the mental requirements are a few gigs.
Due to the size of the graph, I draw a diagram inside the draw method of the scrollpane child. This works well, however, I notice that every time the shifted scrollbar moves, my drawing procedure is called twice - once with a cut out rectangle equal to the unclosed area that scrolls to, and a second time with a cut out rectangle equal to the size of the viewport.
For example, if my viewport is 245x195, and I scroll down 3 pixels, my drawing procedure is called using the g.getClipBounds()following:
java.awt.Rectangle[x=0,y=195,width=245,height=3]
java.awt.Rectangle[x=0,y=3,width=245,height=195]
... because I visualize in a paint routine, it causes flickering (I do my calculations as quickly as possible, but there is a slight chance of a delay that I assume). Questions:
Does anyone know how to prevent a second paint call? This is a simple Jane JScrollPane that I am doing here - I have a component, I add it to scrollpane, I add scrollpane to the parent component. You can see this behavior even in the first demonstration of the scrolling image @ the rotation tutorial .
# 1 "": - ?. - , , ? , , , : -)