User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Java exception error Page [1]  
Novicane
All American
15413 Posts
user info
edit post

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

Novicane
All American
15413 Posts
user info
edit post

n/m figured it out

I had made my text fields instance variables

but 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

philihp
All American
8349 Posts
user info
edit post

with swing, it's usually best to just follow the patterns that sun uses.

2/9/2006 7:15:59 PM

 Message Boards » Tech Talk » Java exception error Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.