This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Displaying data from sqlite to combobox null pointer exception  RSS feed

 
Greenhorn
Posts: 27
  • 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

 
Marshal
Posts: 60199
188
  • 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: 27
  • 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 ?

 
Master Rancher
Posts: 3633
40
  • 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
Marshal
Posts: 60199
188
  • 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
Marshal
Posts: 60199
188
  • 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: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lol thanks guys its all done
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!