Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

AWT problem w/ Windows, but not other platforms

0 views
Skip to first unread message

Hari Nair

unread,
Oct 6, 1999, 3:00:00 AM10/6/99
to
I've written an application to take a component and either render its
image into another window or save the image to a file. It seems to work
well on Solaris, Linux, and IRIX (all under JDK 1.2) but fails on
Windows 95 with the following trace:

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);
}
}

0 new messages