Regards,

David Gilbert wrote:

The ChartPanel class overrides paintComponent(Graphics) and casts the incoming Graphics object the Graphics2D subclass - this is very common in Swing apps as a way to gain access to Java2D features for drawing on Swing components. I'm almost certain that the Graphics object is guaranteed to be a Graphics2D instance, and the original method signature is maintained for backwards compatibility only, although this isn't mentioned in the API specification. The only reference I've been able to find is this one in the Java tutorial:

http://java.sun.com/docs/books/tutorial/uiswing/14painting/practice.html

There it is written "you can cast the |Graphics| parameter into a |Graphics2D| object.", and this is java.sun.com. Looks like documented behavior. Probably it is time to fill in the bug report.

Audrius.


Reply via email to