• 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:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

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: 64473
225
  • 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: 4072
47
  • 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: 64473
225
  • 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: 64473
225
  • 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
 
I am not young enough to know everything. - Oscar Wilde This tiny ad thinks it knows more than Oscar:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!