After Craig Wood (in the Other API's forum) graciously provided me with a nice swing Java2D example, I wanted to run it is as an applet. I have succeeded in converting it -- sort of.
I'm getting the stack trace below when I run it in the applet viewer. (The stack trace is from the appletviewer, not my code). Below that, I have posted my modification of Craig's swing example.
I suspect there is something wrong with the way I converted his swing example to an applet. Craig uses a JScrollPane in his main program and I wanted JScrollPane within the Applet. So I created an JApplet within the JScrollPain within a second JApplet. Was JApplet overkill for the inner applet: could I have used JPanel?
I'm getting the stack trace below when I run it in the applet viewer. I get the same exception although it doesn't occur everytime I close the appletviewer. This started in j2se 1.5 and did not happen in j2se 1.4. I never researched it and have not been able to find a way to avoid it; just figured someone would get it worked out eventually. Was JApplet overkill for the inner applet: could I have used JPanel? I haven't tried your code but probably, yes. An Applet is an extension of Panel (AWT) and a JApplet is and extension of Applet (Swing). So a JApplet can host a JPanel. What makes an Applet/JApplet special is that they are top–level containers. Here is how I would create a JApplet to host the GraphicsOnly component:
The only change required in the GraphicsOnly file is relaxing the access modifier of the getControl method from private to protected so the applet can call/access it.
subject: null Pointer Exception from applet viewer