• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

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

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I call a method from another class and get this error after clicking the button Next


This is build2()


and this is the button


Why does this happen?
 
Saloon Keeper
Posts: 7161
165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The stack trace says the exception occurs in line 188 of class StudSubj; which line is that? And which object used in that line is null?
 
Rancher
Posts: 988
23
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see build2 there, but I don't see any buttons. That ActionListener is not what you report it to be, so perhaps it may be your problem that this not your code? In any case, it is at Tim said, you are not showing any part of the code that is generating the problem.
 
Kenn Briones
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The build2() in the ButtonHandler is the line 188 in the class StudSubj. it is the one causing the problem.
 
Tim Moores
Saloon Keeper
Posts: 7161
165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming that you mean lines 21 and/or 41: what is "aD"? When is it set? Have you checked that it is not null before using it?
 
Kenn Briones
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The aD is set in the StudSubj class.


And this is the whole AllDetails class
 
Tim Moores
Saloon Keeper
Posts: 7161
165
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's where aD is declared, but not set. So, again: Have you checked that it is not null before using it?
 
Kenn Briones
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh. I get it. aD is null.
reply
    Bookmark Topic Watch Topic
  • New Topic