aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes can't understand draw() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "can Watch "can New topic
Author

can't understand draw()

budsy remo
Ranch Hand

Joined: Sep 20, 2008
Posts: 103
the draw(shape s) method is declared abstarct in the Graphics2D class then can someone explain that how is it able to perform any functionality at all because according to me if a method is abstract it doesn't have any definition .
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

Maybe you missed to notice that the entire Graphics class is abstract, and so is its subclass Graphics2D.

In a painting method override, print the class of the Graphics reference:What does that give you?


luck, db
There are no new questions, but there may be new answers.
budsy remo
Ranch Hand

Joined: Sep 20, 2008
Posts: 103
Didn't understand . Where exactly is the definition at all ? of the draw method
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  17

The implementation is *somewhere*. The fact that the method is abstract, doesn't mean it doesn't have an implementation. The implementation is simply not in that class, but in a subclass. You shouldn't worry about it, you can still use the method.
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4421
    
    8

And what Darryl's code does is show you how to find out the exact type of the implementing class, should you be interested.
budsy remo
Ranch Hand

Joined: Sep 20, 2008
Posts: 103
thanks a million darryl and matthew . i found out that the sungraphics2d was the class that implements it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can't understand draw()