Jump to content

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException :S

- - - - -

  • Please log in to reply
2 replies to this topic

#1
talon

talon

    Newbie

  • Members
  • Pip
  • 1 posts
Hi I'm having a lot of trouble with a program I'm doing for some coursework.
At the moment my main problems are :
1. The program wont let me use the savep button which calls the savepart() method
as it throws the error above.
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at Menu.savepart(Menu.java:511)
at Menu.actionPerformed(Menu.java:435)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
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.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(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. I can't seem to push the mypart vector into a Jlist as well because of the same error. I want to be able to select multiple participants then write those into a relationships vector.

Yes I know a database would be better to do this all in ... but its a programming course :(
Any help would be greatly appreciated I've attached the .java file if that helps thanks!

Attached Files



#2
eafkuor

eafkuor

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 218 posts
Seriously, are you posting a 927 line class?
Anyway, if that throws a NullPointerException it simply means the object you are working with it's not been initialized yet.
Wich means that this:

static Vector<participant> mypart = participant.readFile("participant.txt");

returns null for some reason.

#3
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
The whole readFile method is weird. It does nothing with 'mypart' but does return it.
Are you sure you shouldn't return 'addid' in there?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users