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.


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
    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
    Washington, DC
    My Mood
    Thanked 704 Times in 595 Posts

    Default Re: Applet Paint Method

    The g variable references an instance of a *subclass* of Graphics.
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

  3. #3
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 899 Times in 879 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, 14:55
  2. Applet paint program frame work.
    By ShaunB in forum Java Swing Tutorials
    Replies: 5
    Last Post: April 13th, 2013, 21:00
  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
  4. Inheriting Applet and paint() GUI Method Logic?
    By Jakesta42 in forum Object Oriented Programming
    Replies: 1
    Last Post: August 8th, 2011, 06:58
  5. Applet paint program frame work.
    By ShaunB in forum Java Code Snippets and Tutorials
    Replies: 3
    Last Post: May 5th, 2010, 18:35

Tags for this Thread