Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

What does the super.paintComponent(g) do?

843785Jan 11 2009 — edited Jan 11 2009
When I am extending the JPanel I have to super.paintComponent(g) - I know that it is required because a panel like JPanel is opaque but what is it really used for? I don't understand that the code itself paints the panel with the background colour - how does it lose it in the first place? Is there a method in JComponent that the JPanel inherits from JComponent class that makes the JPanel opaque but loses it? If this is true does it lose it as we're using the paintComponent class or as we're extending the JPanel?

Any help is appreciated...

Cheers

Edited by: bastones_ on Jan 11, 2009 11:46 AM

Edited by: bastones_ on Jan 11, 2009 11:54 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 8 2009
Added on Jan 11 2009
1 comment
2,303 views