wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JPanel scroll paint problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JPanel scroll paint problems" Watch "JPanel scroll paint problems" New topic
Author

JPanel scroll paint problems

Lee Barney
Ranch Hand

Joined: May 07, 2003
Posts: 37
I have a JPanel with several objects embedded in it for which I have overwritten paint(). When I scroll the view port, the portions of the objects that used to be outside the view port are painted in the correct positions in the JPanel, but they also are painted in the header.
???
What have I done wrong?
Here is the paint code for the objects in the JPanel. They exist in other JPanels inside the main JPanel mentioned above.
Thank you
Tamizh Selvan
Greenhorn

Joined: Oct 10, 2003
Posts: 15
Try calling invalidate() method.Hope this would solve ur probs
good luck


"No one knows what one can do until one tries"<br />-John Kingsley.
Lee Barney
Ranch Hand

Joined: May 07, 2003
Posts: 37
I tried calling invalidate on the header with a AdjustmentLister and there was no difference. I call revalidate() and repaint() on the header and after the items being painted in the JPanel flash in the header they disapear. It is also kind of chunky during the scroll.
Ideas?
Tamizh Selvan
Greenhorn

Joined: Oct 10, 2003
Posts: 15
k do 1 thing. if u did'nt override the update(Graphics g) method. do it. and call ur paint ur panel only from here. actually i used this approach for removing extra paintings on my applet.Also do try itemChangeListener insted of AdjustmentListener.
good luck.
Marcus
[ October 16, 2003: Message edited by: Marcus Blue ]
 
wood burning stoves
 
subject: JPanel scroll paint problems