I have been repeatedly unsuccessful in getting the Graphics2D class to work in an applet. Everything I've tried compiles OK but I don't get any graphics when run in a browser. The same applets do work in appletviewer, but that doesn't do much good.
I'm using jdk1.2.2. Every other class in the jdk works including all my applets using the regular awt.Graphics class. I even downloaded some Graphics2D examples from sun's tutorial and tried compiling them. They compile successfully but they still don't work and I end up with the PC "gray block". Also, sun's examples work in appletviewer but not a browser.
The java console says it can't find the Graphics2D class.
java.lang.ClassNotFoundException: java.awt.Graphics2D
at com/ms/vm/loader/URLClassLoader.loadClass (URLClassLoader.java)
at java/lang/ClassLoader.loadClassInternal (ClassLoader.java)
etc.
I tried downloading jdk1.3 and installing that on my computer and I still have the same problem. I don't see how everything else could work except Graphics2D. I'm not even trying to do anything complicated. Even something like this doesn't work though it compiles fine:
[red]import java.applet.*;
import java.awt.*;
public class simple extends Applet
{
public void paint(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.blue);
g2.drawString("hello",9,9);
}
}
[/red]
If the VM can't find the Graphics2D class then I don't see how it would run in appletviewer but not a browser. Also, in Netscape I get a security exception in the status bar. Any suggestions or insights appreciated.
I'm using jdk1.2.2. Every other class in the jdk works including all my applets using the regular awt.Graphics class. I even downloaded some Graphics2D examples from sun's tutorial and tried compiling them. They compile successfully but they still don't work and I end up with the PC "gray block". Also, sun's examples work in appletviewer but not a browser.
The java console says it can't find the Graphics2D class.
java.lang.ClassNotFoundException: java.awt.Graphics2D
at com/ms/vm/loader/URLClassLoader.loadClass (URLClassLoader.java)
at java/lang/ClassLoader.loadClassInternal (ClassLoader.java)
etc.
I tried downloading jdk1.3 and installing that on my computer and I still have the same problem. I don't see how everything else could work except Graphics2D. I'm not even trying to do anything complicated. Even something like this doesn't work though it compiles fine:
[red]import java.applet.*;
import java.awt.*;
public class simple extends Applet
{
public void paint(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.blue);
g2.drawString("hello",9,9);
}
}
[/red]
If the VM can't find the Graphics2D class then I don't see how it would run in appletviewer but not a browser. Also, in Netscape I get a security exception in the status bar. Any suggestions or insights appreciated.