I would like to populate a JTable with the cnstructor like this :
new JTable(datas, columns);
so I need an Object[] for the columns and a Object[][] for the datas.
The problem is when I try to get the datas.
In one of my method I work with an ArrayList<ArrayList<Object>> and I would like to cast it to an Object[][].
Here's a sample of my code :
ArrayList<ArrayList<Object>> datas = new ArrayList<ArrayList<Object>>();
for (Map.Entry<Integer, JSObject> entry : params.entrySet()) {
datas.add(entry.getValue().getValues()); // getValues returns an ArrayList<Object>
}
return new datas.toArray(); // not seems to work
I saw in this question Convert ArrayList<Object[]> to Object[][] some idea, but I'm not sure about the result.
Thanks in advance !
Object[][]directly fordatas?return new datas.toArray();is not a valid statement (newshould probably be removed)ArrayListbut I try this solution, and let you know what comes from it... And yes thenewhad nothing to do here, thanks