General software, Operating Systems, and Programming discussion.
Everything from software questions, OSes, simple HTML to scripting languages, Perl, PHP, Python, MySQL, VB, C++ etc.
I'm doing a small applet. All it does is it has a textfield for input by pressing enter and as well some buttons so I have ActionListener and KeyListener. I'm using swing for the GUI. I placed my components into init().
Everything works fine but when I view it with appletviewer and then close it, it gives this error.
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: component
argument pData
at sun.awt.windows.Win32SurfaceData.initOps(Native Method)
at sun.awt.windows.Win32SurfaceData.<init>(Win32SurfaceData.java:448)
at sun.awt.windows.Win32SurfaceData.createData(Win32SurfaceData.java:316
)
at sun.awt.Win32GraphicsConfig.createSurfaceData(Win32GraphicsConfig.jav
a:357)
at sun.awt.windows.WComponentPeer.replaceSurfaceData(WComponentPeer.java
:332)
at sun.awt.windows.WComponentPeer.replaceSurfaceData(WComponentPeer.java
:313)
at sun.awt.windows.WComponentPeer$2.run(WComponentPeer.java:353)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
that's when closing the applet viewer? try it in a browser and see what happens and let me know. could just be an issue w/ the applet viewer itself. it looks like an issue in the swing thread code, but not positive.
applets are meant to be run in web browsers, generally. if you're wanting a standalone application, add the panel to a jframe instead of an applet, then you will not have this issue.