JDK-4262543 : DebugGraphics extends Graphics, not Graphics2D
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0
  • Priority: P5
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 1999-08-14
  • Updated: 2017-05-19
Description
Name: dbT83986			Date: 08/14/99


I created a Swing component, implemented my own drawing code,
and discovered I'm having a problem getting it to paint correctly.
Enabling DebugGraphics, I get a class cast exception.  Since I'm
using the 2D drawing API, I need to make calls to the Graphics2D
class, but because DebugGraphics only extends Graphics, I can't.
(Review ID: 93663) 
======================================================================

Comments
EVALUATION I wrote a DebugGraphics2D (see a webrev in the attachment), but it's features are still under discussion. The discussion results can be found here: http://j2se.sfbay.sun.com/web/bin/view/Swing/SwingDebugging I will continue my work when all features will be discussed.
30-11-2006

EVALUATION We need to create DebugGraphics2D class which extends Graphics2D and wrap another Graphics2D object then in JComponent we'll do something like if(g instanceof Graphics2D) { return new DebugGraphics2D((Graphics2D)g) } else { //old code is here return new DebugGraphics(g); }
06-05-2006

WORK AROUND Name: dbT83986 Date: 08/14/99 No work arounds. If you use the 2D API, you're screwed. ======================================================================
24-09-2004

EVALUATION Yes, this is a good idea. ###@###.### 2001-11-12
12-11-2001