Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi- I am having a problem with a

Status
Not open for further replies.

jay123454

Programmer
Jun 15, 2001
46
US
Hi-
I am having a problem with a NullPointerException that doesn't seem to make any sense to me...hopefully someone here can give me a clue as to why i'm getting it. I've been re-writing and changing things around but nothing seems to work...here's the codethat seems to be causing the problem(Prob desc. below):
*************************************************

JButton addButton = new JButton("Add a File...");
addButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int returnVal = fc.showOpenDialog(ChooseFiles.this);

if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
Object obj = file;
log.append("Adding: " + file.getName() + "." + curntline);
current.addObj(obj);
//_a.setMovie(current);
System.out.println(current.getFirst());
System.out.println(current.size());
_a.setMovie(obj);
} else {
log.append("Add command cancelled by user." + curntline);
}
_current = current;
}
});
***********************************************
the NullPointer is coming on the line{_a.setMovie(obj);}
I'm using JFileChooser to add a file to a LinkedList, and i can get the file and add it to a LinkedList no problem in this loop....but when i try to use the LinkedList elsewhere in the class i get NullPointerException...the LinkedList is declared in the class variables and instantiated in the class definition.
As you can see, I've even tried just passing the Object that is storing the file to another class and adding it to the LinkedList there and I am still getting the NullPointer on the Object this time...even though i use the Object in the two lines above to test to see if it is working....this doesn't make any sense to me.
can anyone HELP!
thanks much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top