I created a simple applet where I am using the JDateChooser class. I compiled my applet and got no errors. But I get this error at execution time: java.lang.NullPointerException at javax.swing.ImageIcon.<init>(Unknown Source) at com.toedter.calendar.JDateChooser.<init>(JDateChooser.java:172) at com.toedter.calendar.JDateChooser.<init>(JDateChooser.java:111) at CalendarApplet.init(CalendarApplet.java:19) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Exception in thread "thread applet-CalendarApplet.class" java.lang.NullPointerException at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source) at sun.plugin.AppletViewer.showAppletException(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
Here's my simple applet code:
Funny thing is, if I go back to the applet code above and substitute JDateChooser with JCalendar, it works without problems. Any ideas why I'm having problems with JDateChooser? Thanks.
Joined: Mar 22, 2005
Welcome to JavaRanch.
I can only report that the applet works fine on OS X, so I can't guess why it might cause problems elsewhere. Maybe someone else can try it on Windows.
Well...I compiled the applet using Java SDK 1.5.6 on WinXP machine. What's also weird is, I just created a regular Java application, not applet, again using JDateChooser class and it works fine with no problems. This is driving me nuts. For some reason, I can't use the JDateChooser class in an applet environment on my machine. I tried to download an earlier version of the JCalendar (1.1.4) package, but it doesn't have the JDateChooser class. I prefer to use the JDateChooser class since it is more compact, doesn't take as much space as the JCalendar class. I tried using both Firefox browser and IE, still no go on my machine. Oh well.
I e-mail Mr. Kai Toedter, hopefully he can help. I guess for the time being I can live with using the JCalendar class. Thanks again.
Joined: Dec 17, 2005
If anyone's interested, apparently the JDateChooser class does not work with JRE 1.5 update 6. Dunno about earlier updates. I uninstalled 1.5 and installed 1.4 update 10. My applet now works. I already sent Mr. Toedter an e-mail to inform him of this.