0

Since repaint() calls paint(), isn't calling repaint() at the end of the paint() method using recursion endlessly? If so, why am I not getting a stack overflow error?

ahab
  • 1
  • 2
  • It's not actually a recursive call. Calling `repaint()` just enqueues an event that does the painting later. It's similar to calling `SwingUtilities.invokeLater(...)`. – Radiodef May 29 '18 at 15:08

1 Answers1

0

No, it's not dangerous, since it will just queue in a new paint request. It's actually well known practice when developing small games with swing :) At least it was at my university!