Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPanel scroll paint problems

 
Lee Barney
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try calling invalidate() method.Hope this would solve ur probs
good luck
 
Lee Barney
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic