• Post Reply Bookmark Topic Watch Topic
  • New Topic

Displaying data from sqlite to combobox null pointer exception  RSS feed

 
yunus emre güney
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like somethng changed with combobox usage but i couldnt make this work.Database connection and other stuff working

This is the code:

How do i define combobox ? this is not working: what should i write argument

 
Campbell Ritchie
Sheriff
Posts: 54089
130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look in the Java™ Tutorials about combo boxes. Where did you initialise the combo box field?
 
yunus emre güney
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Have a look in the Java™ Tutorials about combo boxes. Where did you initialise the combo box field?


Full code is here.Can you check fillCombBox method ?

 
Dave Tolls
Ranch Hand
Posts: 2566
27
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

This code is initialising a different comboBox variable than the one declared at the top of the class, and used by your other method.
Consequently that comboBox variable is always null.
 
Campbell Ritchie
Sheriff
Posts: 54089
130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well done finding that; I couldn't seem to see it. Anyway, the field hasn't been initialised.
OP: Since your catch blocks use different parameter names (e1 and e2), I suggest you remind yourself of the rules about scope of variables, so you can work out whether the different names are necessary. The error wasn't in the method you quoted.
 
Campbell Ritchie
Sheriff
Posts: 54089
130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are other errors; using setBounds on a child component suggests you are making the mistake of using absolute positioning and a null layout. Please remind yourself of the different layouts available.
 
yunus emre güney
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lol thanks guys its all done
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!