• Post Reply Bookmark Topic Watch Topic
  • New Topic

(paint) autoCall??  RSS feed

 
Sammer Meer
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The (paintComponent) method for the JPanel(or the (paint) method in Canvas)executes without calling repaints.. When first i add the canvas into the frame .. it is called.. why??? it's not convenient at all.. can u give me an idea about what happens and why?
[ April 14, 2004: Message edited by: Saeed Meerkhan ]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It happens because components repaint for lots of reasons... when they first become visible, when something partially covers them, when their model updates, etc. It would be a lot more of a pain if you had to manually tell components when they could repaint.

What is the problem that is caused when you add the canvas to the frame? And what end result are you trying for? There's probably another way to get the result you want that won't cause a problem.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!