Okay, using the swing JTable with the gui instead of the command line?
That's no problem to do, but I'd recommend not using Object[][] as your data handling. Instead, use the TableModel of the JTable as it will accept a collection of object.
The TableModel is easiest done with the DefaultTableModel (or you can write your own, but that's a more advanced feature). Its use is simply as such:
PHP Code:
JFrame frame = new JFrame("Commission Sample Table");
TableModel tmData = new DefaultTableModel();
JTable table = new JTable(tmData);
((DefaultTableModel)tmData).addColumn("Total Sales");
((DefaultTableModel)tmData).addColumn("Total Compensation");
frame.getContentPane().add(new JScrollPane(table));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(0, 0, 600, 600);
frame.setVisible(true);
Now, TableModel can be given new rows on the fly. This is still beneficial even if not responding to events; adding new records is simply accepting Object[] or vectors. For an example:
PHP Code:
public static void insertCalculatedNumbers(DefaultTableModel tm, double dStart)
{
for (double d = dStart; d <= dStart * 1.5; d += 5000)
{
tm.addRow(new Object[]{d, "Calculated Result Here"});
}
}
Given a DefaultTableModel, this will increment dStart by 5000 until it hits 1.5x the size of dStart. It will insert a new row on each iteration. Calculated result is probably best done in another method instead of inline with this code.