1

I know that when paint is happening an instance of the Graphics class should be created. That Graphics object (Actually Graphics2D object) is going through paint() method and all the details that should be printed or updated on the screen are stored in that object.

As I know of this process is handled by RepaintManager when user called repaint() method or when repaint is needed to the UI. So, a Graphics instance has to be created to store the information regarding the painting.

As this process is handled by RepaintManager, I thought that the Graphics instance is also initialized inside RepaintManager. But I found source code of RepaintManager recently. And couldn't find a place that a new Graphics instance is created.

So, is it really created inside RepaintMananger or anywhere else..?
Thanks..

Ramesh-X
  • 4,853
  • 6
  • 46
  • 67

1 Answers1

0

It's created in Component.getGraphics() see the API for more information

ControlAltDel
  • 33,923
  • 10
  • 53
  • 80
  • Thanks.. I thought it is there to be used by programmers to edits the component's graphics. I didn't know that it is used by `RepaintManager` also.. – Ramesh-X Dec 17 '15 at 16:40