java.lang.ClassCastException: sun.awt.image.BufferedImageGraphics2D

Oracle Community | 843797 | 2 decades ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    How do you extend the Graphics2D class?  Compiles but gives run-time errors

    Oracle Community | 2 decades ago | 843797
    java.lang.ClassCastException: sun.awt.image.BufferedImageGraphics2D

    Root Cause Analysis

    1. java.lang.ClassCastException

      sun.awt.image.BufferedImageGraphics2D

      at GPanel.paintComponent()
    2. Unknown
      GPanel.paintComponent
      1. GPanel.paintComponent(Graphics.java:129)
      1 frame
    3. Java RT
      EventDispatchThread.run
      1. javax.swing.JComponent.paint(Unknown Source)
      2. javax.swing.JComponent.paintWithBuffer(Unknown Source)
      3. javax.swing.JComponent._paintImmediately(Unknown Source)
      4. javax.swing.JComponent.paintImmediately(Unknown Source)
      5. javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
      6. javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
      7. java.awt.event.InvocationEvent.dispatch(Unknown Source)
      8. java.awt.EventQueue.dispatchEvent(Unknown Source)
      9. java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
      10. java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
      11. java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      12. java.awt.EventDispatchThread.run(Unknown Source)
      12 frames