Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting NullPointerExceptionError when working with the CheckboxGroup

 
earl elliott
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to java, so come down a level when offering your suggestions. This is what i did:
I have a calling pgm that passes control a called pgm. in that called pgm, i've set up a CheckboxGroup, with 3 Checkbox tied to it. Further down in this called pgm, i have the
Public void itemStateChanged(ItemEvent theEvent)
{
if (checkingServicesbox.getState() )
(ItemListener) (getParent()).itemStateChanged() //something like this, and allit does is transfer control back to the called pgm's itemStateChanged() method.
***** so far so good....everything works up to this point *******
once control is passed back to the called program's itemStateChanged() method, that tis where i get this NullPointerExceptionError.
in the called pgm i have the following:
public void itemStateChanged(ItemEvent theEvent)
{
if (serviceList.checkingServicesbox.getState())
{
. etc etc
.
}
}
This if stmt above causes the exception.....serviceList is an instance of the called pgm. i hope this makes sense...ugh...
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch!
Not only did you find this great site, but your name complies with The JavaRanch Naming Policy - so you must be very intelligent.
With questions of this type, educated guesses could be made with the information you've provided. In my experience, however, those educated guesses are all too often countered with:
"Oh, no, because of this part I didn't mention."
or
"Nope. That part's fine. Got any more bright ideas Mr. Bartender?!"
So, while I appreciate your attempt to whittle the problem down to the bare essentials, I suspect that relevant information is missing. I suggest just posting the code for the two classes (unless we're talking a thousand lines here, in which case could you post shortened versions that duplicate the problem and are complete class descriptions) while being certain to use the [ code ] and [ /code ] tags (without the whitespace) to surround your code in order to preserve the formatting.
Thanks and Good Luck.
Note: The tab character maintains a relation to the devil - please avoid it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic