Note that there are some explanatory texts on larger screens.

plurals
  1. POPopulating jTable using List
    primarykey
    data
    text
    <p>I have a list of data which I got from my Json file using Json Jackson, how can I populate jTable from this list?</p> <pre><code>[{"id":1,"name":"Bambola","description":"Opis...","contact_number":"022\/349-499","email":"","address":"Svetosavksa 23","geo_latitude":"44.96868000000000","geo_longitude":"20.28140000000000","created_at":"2013-06-24 14:15:08","updated_at":"2013-06-24 14:15:08","deleted_at":null,"publication_starts":"1991-05-24 01:00:00","publication_ends":"1991-05-24 01:00:00"},{"id":2,"name":"Master","description":"Opis...","contact_number":"022\/349-123","email":"","address":"Svetosavksa 24","geo_latitude":"44.96653000000000","geo_longitude":"20.28170000000000","created_at":"2013-06-24 14:15:08","updated_at":"2013-06-24 14:15:08","deleted_at":null,"publication_starts":"0000-00-00 00:00:00","publication_ends":"0000-00-00 00:00:00"},{"id":3,"name":"Tritel","description":"Opis...","contact_number":"022\/321-499","email":"","address":"Svetosavksa 25","geo_latitude":"44.96654000000000","geo_longitude":"20.28170000000000","created_at":"2013-06-24 14:15:08","updated_at":"2013-06-24 14:15:08","deleted_at":null,"publication_starts":"0000-00-00 00:00:00","publication_ends":"0000-00-00 00:00:00"}] </code></pre> <p>Using the Json Jackson parser I have populated the List with this data.</p> <pre><code>List&lt;Advertisement&gt; advertisements = mapper.readValue(url, new TypeReference&lt;List&lt;Advertisement&gt;&gt;(){}); </code></pre> <p>Now I want to populate the jTable, I have used the NetBeans GUI builder to create frame and the table. The table name is advertisementList_JT. So far what I have tried is this snippet of code found in a simillar question here on the site.</p> <pre><code>DefaultTableModel model = new DefaultTableModel(); for (Advertisement adv : advertisements) { Object[] o = new Object[3]; o[0] = adv.getName(); o[1] = adv.getPublication_starts(); o[2] = adv.getPublication_ends(); model.addRow(o); } advertisementList_JT.setModel(model); </code></pre> <p>With this snippet the table when I start the application just goes gray and nothing happens, looked thru the debugger and no errors either.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload