This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

In (Graphics g) method...is g an object of Graphics2D?  RSS feed

 
Vasiq Molvizadah
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm reading Head First Java ...and in the GUI chapter it says that...in the method

void paintComponent (Graphics g)

"The object referenced by the "g" parameter is actually an instance of the Graphics2D class."

I don't get this statement..because Graphics2D is a subclass of Graphics class...
Any help on this...guys
 
Rob Camick
Ranch Hand
Posts: 2754
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means you can treat the Graphics object like a Graphics2D object by casting it:



 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!