Results 1 to 2 of 2
  1. #1
    wassat676 is offline Member
    Join Date
    May 2011
    Rep Power

    Default a "draw()" function

    So i have this assignment, and in it im supposed to make a shape class (circle, sqare, etc.) and then extend that class and add a "draw()" function, some colors, blabla. The endgame is, we take another students shape and combine it into a GUI application. Press buttons, shapes appear. All of this is fine and I understand, but my instructor says the draw() function has to take a Graphics object as an argument, am I crazy or is paintComponent() the exact same thing. How would any of you implement this draw() function. I have do it because we are adding the draw() method to an interface with some other things as part of the next assignment.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power


    The paintComponent method is called by the JVM. It can do some stuff and then call your new draw methods as needed.

Similar Threads

  1. Replies: 3
    Last Post: 04-29-2011, 02:08 AM
  2. How correctly invoke function "round"?
    By artemff in forum New To Java
    Replies: 2
    Last Post: 01-01-2010, 12:31 PM
  3. How "Pattern.matches(regex, input)" function works?
    By kishan in forum Advanced Java
    Replies: 2
    Last Post: 04-26-2009, 01:46 AM
  4. Replies: 2
    Last Post: 01-24-2009, 07:56 PM
  5. Replies: 1
    Last Post: 10-20-2008, 08:35 AM

Posting Permissions

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