A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Head First Android
this week in the
Swing / AWT / SWT
In (Graphics g) method...is g an object of Graphics2D?
Joined: Dec 24, 2009
Feb 28, 2010 22:11:03
I'm reading Head First
...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
Human Knowledge Belongs to the World.
- Vasiq Mz
Joined: Jun 13, 2009
Feb 28, 2010 22:51:27
It means you can treat the Graphics object like a Graphics2D object by casting it:
Graphics2D g2d = (Graphics2D)g;
I agree. Here's the link:
subject: In (Graphics g) method...is g an object of Graphics2D?
Wrinting a string vertically
Code Barn example Shape - I have a question..
a question about JPanel
Question on inheritance!
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015