Top.Mail.Ru
November 19th, 2005 - Java developers — LiveJournal
? ?

Java developers

November 19th, 2005

04:13 pm - 0olong - Applets vs. Applications

Hello again,

I've read in more than one place that it should be possible to turn an applet into an application by (essentially) just implementing a main method which adds the Applet (or JApplet) object to a Frame (or JFrame) and then calls the necessary Applet methods which would otherwise be invoked by a browser. When I try to do this, though, I keep getting a NullPointerException as soon as I try to do anything with a Graphics object. It appears that getGraphics() just isn't creating a graphics context, whether I invoke it directly from the applet or on a class derived from JPanel... and I have no idea why.

Anyone got a clue?

Thanks!
Powered by LiveJournal.com