wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes probem with populating JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "probem with populating JTable" Watch "probem with populating JTable" New topic
Author

probem with populating JTable

Pradeep Selvaraj
Greenhorn

Joined: Sep 29, 2003
Posts: 17
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
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
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

Joined: Sep 29, 2003
Posts: 17
Thnx Craig.Thank you so much.It was really helpful.Your help is highly appreciated.
 
Don't get me started about those stupid light bulbs.
 
subject: probem with populating JTable
 
Similar Threads
JTable
ERROR in all jtable cells using DefaultTableModel
JTABLE PROBLEM
doubt in JTable
Jtable and Scrollbar