• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

probem with populating JTable

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there,

I am just looking for populating JTable from the ArrayList.I am trying to do that by get a NullPointerException.

here is the code snippet


Could any one plz help me out.Incase if my logic wrong can u guyz help me to populate records into JTABLE.

Thank you,

Pradeep
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unless the Disk class has some method that returns its fields (instance variables) with an index or, as an array or, as a String that you can split into an array you'll have to hard–code the fields into the table columns as in the code below.

Instead of having the List list in class scope you could have createList return a reference to the list, ie

and send it into the getTable method as an argument. Either way, a reference to list must be available inside the getTable method or you get a NullPointer. NullPointer means "we can't find it!".

The stack trace that starts with "NullPointerException" will tell you the line number where the exception was thrown. Just count down the lines in your source code file to find out where the exception was thrown.
 
Pradeep Selvaraj
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thnx Craig.Thank you so much.It was really helpful.Your help is highly appreciated.
 
Blueberry pie is best when it is firm and you can hold in your hand. Smell it. And smell this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic