Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Applet Paint Method

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Applet Paint Method

    i am confuse about paint() method in applet .The confusion is that paint method is getting object as parameter of Graphics class like this public void paint(Graphics g) and i read that the Graphics class is an abstract class then how we create object of Graphics class and
    now you will say that g in Graphics g is reference not actual object and we can create reference of abstract class i know this but g is a reference not object then how can we call a class member with reference object same like this

    `g.drawString("hello world",15,30)`

    this is out of my senseif that is possible then write a very simple code in which a method get object as parameters of abstract class and call the method of abstract class please help me about this my english is very poor but i hope i completely explain my problem.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,441
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 544 Posts

    Default Re: Applet Paint Method

    The g variable references an instance of a *subclass* of Graphics.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,733
    My Mood
    Mellow
    Thanks
    232
    Thanked 706 Times in 692 Posts

    Default Re: Applet Paint Method

    Thread moved.

Similar Threads

  1. New paint method? Please help?
    By xkendzu in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 13th, 2014, 02:55 PM
  2. Applet paint program frame work.
    By ShaunB in forum Java Swing Tutorials
    Replies: 4
    Last Post: October 31st, 2012, 08:44 AM
  3. Applet array paint/print question
    By allhuber in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 30th, 2012, 07:42 AM
  4. Inheriting Applet and paint() GUI Method Logic?
    By Jakesta42 in forum Object Oriented Programming
    Replies: 1
    Last Post: August 8th, 2011, 06:58 AM
  5. Applet paint program frame work.
    By ShaunB in forum Java Code Snippets and Tutorials
    Replies: 3
    Last Post: May 5th, 2010, 06:35 PM

Tags for this Thread