Results 1 to 11 of 11
Like Tree1Likes
  • 1 Post By JosAH

Thread: Why Super.paint(g)?

  1. #1
    Daryn is offline Senior Member
    Join Date
    Oct 2012
    Posts
    176
    Rep Power
    4

    Default Why Super.paint(g)?

    So I have been programing for about a year and a half now in java and have never seen a use for the super.paint(). So why is everyone using it?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,292
    Blog Entries
    7
    Rep Power
    24

    Default Re: Why Super.paint(g)?

    Quote Originally Posted by Daryn View Post
    So I have been programing for about a year and a half now in java and have never seen a use for the super.paint(). So why is everyone using it?
    Because most of them didn't read the documentation: you should call super.paintComponent(g) if you want the super class to paint first (or last); calling super.paint(g) would cause nasty recursion in Swing.

    kind regards,

    Jos
    gimbal2 likes this.
    The only person who got everything done by Friday was Robinson Crusoe.

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,113
    Rep Power
    9

    Default Re: Why Super.paint(g)?

    Quote Originally Posted by JosAH View Post
    Because most of them didn't read the documentation
    Yeah Oracle should make a youtube tutorial.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,292
    Blog Entries
    7
    Rep Power
    24

    Default Re: Why Super.paint(g)?

    Quote Originally Posted by gimbal2 View Post
    Yeah Oracle should make a youtube tutorial.
    Rumours say that Oracle is contracting Disney Studios because they want Donald Duck as their voice over for their new tutorials ...

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

  5. #5
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    11

    Default Re: Why Super.paint(g)?

    Quote Originally Posted by gimbal2 View Post
    Yeah Oracle should make a youtube tutorial.
    Oh please no. With my experience of their support I can't even begin to imagine how wrong (and ugly) this could go.

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,292
    Blog Entries
    7
    Rep Power
    24

    Default Re: Why Super.paint(g)?

    And Huey, Dewey, and Louie explain the SE core classes ...

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,113
    Rep Power
    9

    Default Re: Why Super.paint(g)?

    Quote Originally Posted by masijade View Post
    Oh please no. With my experience of their support I can't even begin to imagine how wrong (and ugly) this could go.
    I hope you realize I'm being sarcastic right? I could assume it but I want it to be 100% sure.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  8. #8
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,292
    Blog Entries
    7
    Rep Power
    24

    Default Re: Why Super.paint(g)?

    Quote Originally Posted by gimbal2 View Post
    I hope you realize I'm being sarcastic right? I could assume it but I want it to be 100% sure.
    Sarcasm? We wouldn't recognize sarcasm if it were dancing on a piano, wearing a purple tutu, singing "I am sarcasm, I am being sarcastic" ...

    kindest regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

  9. #9
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    11

    Default Re: Why Super.paint(g)?

    Quote Originally Posted by gimbal2 View Post
    I hope you realize I'm being sarcastic right? I could assume it but I want it to be 100% sure.
    I figured, but knowing script kiddies today, this would be exactly what they look for.

  10. #10
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,113
    Rep Power
    9

    Default Re: Why Super.paint(g)?

    Quote Originally Posted by masijade View Post
    I figured, but knowing script kiddies today, this would be exactly what they look for.
    Sorry for doubting you, that is the -exact- basis of my sarcastic remark ;)
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  11. #11
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    5,299
    Rep Power
    9

    Default Re: Why Super.paint(g)?

    Jos, you just quack me up!

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Paint--- trying to paint an oval
    By noobie_nate in forum Java 2D
    Replies: 2
    Last Post: 06-05-2013, 05:45 PM
  2. Paint is invalid type for variable paint.
    By minibronya in forum New To Java
    Replies: 3
    Last Post: 05-25-2012, 05:52 AM
  3. I am a super noob with a super noob question.
    By LittleZoppo in forum Java Applets
    Replies: 3
    Last Post: 04-27-2012, 03:50 AM
  4. About super.paint()
    By jordan2816 in forum Java Applets
    Replies: 1
    Last Post: 01-24-2011, 12:14 PM
  5. calling variable using super super..
    By Stephen Douglas in forum New To Java
    Replies: 7
    Last Post: 08-16-2010, 06:12 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •