Thursday, 5 September 2013

Java: Console output in JTable

Java: Console output in JTable

This is driving me crazy. Im currentltly working on a school Project. The
programm shuld list Volumes in a JTable.
For Example: I get this output form the vollist.java class.
while (volumeIter.hasNext()) {
volume = volumeIter.next();
System.out.println(volume.getName());
}
Console Output:
vol1
vol2
vol3
...
Now the question is, how i get this console output in my JTable.
table = new JTable();
table.setModel(new DefaultTableModel(
new Object[][] {
{null, vollist.volname(), null, null, null},
{null, vollist.volname(), null, null, null},
{null, vollist.volname(), null, null, null},
},
new String[] {
"Nr:", "Volume Name", "TotalSize [MB]", "Used [MB]", "Status"
}
));
That only displays row1 -> vol1 row2 -> vol1 ...... How can i get an
output like in the console row1 -> vol1 row2 -> vol2 (count up)

No comments:

Post a Comment