I found out that you need to call dispose () on the Graphics objects that you created when you are done with them. However, it is difficult for me to learn from the API documentation when creating Graphics objects.
Obviously, when a Graphics object is passed into a callback, I did not create it and should not discard it (or change it in any other way from what I heard), and if I call Graphics.create (), then I create it and I have to get rid of him.
But what about when I call Component.getGraphics ()? Is this creating a new Graphics2D object for which I am responsible for deleting, or is it returning a link to an existing object that I should not modify? The documentation does not say anyway.
pavon source
share