• Post Reply Bookmark Topic Watch Topic
  • New Topic

repaint causes stack over flow

 
Mohamad Samy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following code where I call panel repaint method from the action listener of the calc button but it causes stack over flow but when I modify it to call paint component method and removing the super term, the program executes. here is the code
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try super.paintComponent(g) instead.

The problem is that paint() calls paintComponent(). And you've changed that to call paint(), which calls paintComponent()...etc.
 
Mohamad Samy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got you. you mean paint called paint component which called super paint causing infinite recursive calls led to stack over flow. thanks very much
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!