我得到了一个类对象数组(名为:store)。我必须从存储数组中检索一些值,并希望用这些值填充我的 JTable(Object[][] 数据)。我已将此数组传递到一个类中,我计划在其中绘制我的用户界面,其中也包括表格。所以,我的代码看起来像
public class Dialog { // Here is where i plan to draw my UI (including the table)
....
public Dialog(Store store) { // Store = an array of class object.
.. }
private class TableModel extends AbstractTableModel {
private String[] columnNames = {"Selected ",
"Customer Id ",
"Customer Name "
};
private Object[][] data = {
// ????
};
}
}
现在,我的问题是,如果我想确保我的设计是一个好的设计并遵循 OOP 的原则,那么我应该在哪里从 store 中提取值,以及我应该如何将它传递给 data[][]。