wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes In (Graphics g) method...is g an object of Graphics2D? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "In (Graphics g) method...is g an object of Graphics2D?" Watch "In (Graphics g) method...is g an object of Graphics2D?" New topic
Author

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

Vasiq Molvizadah
Ranch Hand

Joined: Dec 24, 2009
Posts: 66
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


Human Knowledge Belongs to the World.
- Vasiq Mz
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2152
    
    7
It means you can treat the Graphics object like a Graphics2D object by casting it:



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: In (Graphics g) method...is g an object of Graphics2D?
 
Similar Threads
interesting question!!!!!!!
Code Barn example Shape - I have a question..
Question on inheritance!
a question about JPanel
Wrinting a string vertically