Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

graphics fillRect and getColor

 
prashant sushant
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the fill Rect,setColor etc are all abstarct methods.....so how can we direclty use them with a graphics opject....
 
Rob Spoor
Sheriff
Posts: 20827
68
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

The Graphics object that is passed to the paint methods is an instance of some unknown sub class of Graphics. Usually it's also an instance of an unknown subclass of Graphics2D. That's all you need to know; you can use the methods defined in Graphics (and Graphics2D after casting) without having to worry about how and where they are implemented.
 
Darryl Burke
Bartender
Posts: 5162
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
prashant, we don't have too many rules around here, but we do ask that you BeForthrightWhenCrossPostingToOtherSites.

http://www.java-forums.org/awt-swing/46836-graphics-fillrect-getcolor.html

edit And http://www.javaprogrammingforums.com/awt-java-swing/10055-graphics-fillrect-getcolor.html
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!