Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Graphics2D issues  RSS feed

Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I made my extension of JPanel and am trying to use an instance of Graphics2D in order to draw it up. It's supposed to look like a clock eventually but never mind that now. The problem is that when I implement the paintComponent(Graphics g) method I lose the background that was implemented in the initialize method. I tried moving the contents of initialize to the constructor but that doesn't help the problem. All I see is what I draw up in the paintComponent method, and the background disappears. Does paintComponent override initialize, somehow?

Here's my JPanel extension:

Some of it is in Dutch (again). AFMETING means size, STRAAL is the radius of the circle.

If anyone could give me a hand with this would be awesome. I was here before with a problem and was very impressed with the helpful people on this forum.
I'm so happy! And I wish to make this tiny ad happy too:
ScroogeXHTML 7.2 - RTF to HTML5 / XHTML converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!