Exception occurred during event dispatching:
java.lang.ClassCastException: sun.awt.image.BufferedImageGraphics2D
at sun.awt.windows.WComponentPeer.print(WComponentPeer.java:96)
at sun.awt.windows.WCanvasPeer.print(WCanvasPeer.java:47)
at sun.awt.windows.WPanelPeer.print(WPanelPeer.java:24)
at java.awt.Component.printAll(Component.java:1982)
at apps.ShowSnapShotApp.<init>(ShowSnapShotApp.java:16)
at tools.ShowSnapShot.initTool(ShowSnapShot.java:27)
Any ideas what might be wrong? Is this a bug in Sun's JDK for Windows?
Thanks for any advice!
Hari
P.S. Here's the code for ShowSnapShotApp. It's pretty simple.
package apps;
import java.awt.*;
public class ShowSnapShotApp extends DisplayApp
{
Component component;
Image image;
public ShowSnapShotApp (Component C)
{
component = C;
Dimension size = component.getSize ();
image = component.createImage (size.width, size.height);
Graphics g = image.getGraphics();
component.printAll (g);
setSize (size.width, size.height);
}
public void paint (Graphics g)
{
g.drawImage (image, 0, 0, this);
}
}