I have nothing set to null. A method runs that is suppose to change my Jtextfield text on a click event and I get this error:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at ControlPanel.displayCounters(ControlPanel.java:177) at AntWorldPanel.mouseClicked(AntWorldPanel.java:55) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
2/9/2006 4:58:26 PM
n/m figured it outI had made my text fields instance variablesbut when I created them in the method, I reMade them:JTextField mylabel = new JTextField("blah")where as it should have been:myLabel = new JextField("blah")So my other method could access the text.
2/9/2006 6:16:00 PM
with swing, it's usually best to just follow the patterns that sun uses.
2/9/2006 7:15:59 PM