File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Graphics2D issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Graphics2D issues" Watch "Graphics2D issues" New topic

Graphics2D issues

Oscar Bartman

Joined: Mar 23, 2013
Posts: 10
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 agree. Here's the link:
subject: Graphics2D issues
It's not a secret anymore!