File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Graphics Class

 
Utkarsh Chowdhary
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We say abstract class object can't be created.Then how Abstract class Graphics referance is passed in the method paint(Graphics g).When mehod inside abstract class like drawLine is also abstract then where it is defined?
Also plz tell me how the paint method is invoked automatically?
 
David Freels
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Component has a reference to a graphics object; component.getGraphics. Paint is invoke by the VM when an object needs to be painted.
david
 
usman ahmad
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll tell you about paint()
When you change a drawing in an applet, you call the repaint() method to repaint the applet surface. The repaint() method calls the update() method. The update() method clears the viewing area and calls the paint() method, which contains the drawing instructions.
I hope this is helpful
Regards,
Usman
 
Randall Twede
Ranch Hand
Posts: 4353
2
Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Utkarsh,
What happens is behind the scenes repaint() creates a class that extends graphics and upcasts it to a Grahics reference. It then calls update, passing it this object as a parameter. You will find this behavior throughout the API.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic