What does super.paintComponent(g) do?

前端 未结 2 1173
青春惊慌失措
青春惊慌失措 2020-11-29 05:38

What does super.paintComponent(g) do (especially when we place it inside paintComponent() method)? I am surprised I don\'t see anyone asking this in SO before.<

2条回答
  •  悲哀的现实
    2020-11-29 05:49

    From the Java Painting Tutorial:

    Most of the standard Swing components have their look and feel implemented by separate "UI Delegate" objects. The invocation of super.paintComponent(g) passes the graphics context off to the component's UI delegate, which paints the panel's background. For a closer look at this process, see the section entitled "Painting and the UI Delegate" in the aforementioned SDN article.

提交回复
热议问题