this.setLayout(new BorderLayout());
this.tableModel = new DepartTabelModel(DepartmentDaoFactory.getDepartmentDao()
.getColumnNames(), DepartmentDaoFactory.getDepartmentDao().getDeptModel()); this.deparTable.setModel(tableModel);
this.add(new JScrollPane(this.deparTable), BorderLayout.CENTER);
其中类DepartTabelModel 继承 AbstractTableModel
效果如图
其中
DepartmentDaoFactory.getDepartmentDao()
.getColumnNames()是返回一个List,其数据就是表格头部数据(部门编号,部门名称,备注)
DepartmentDaoFactory.getDepartmentDao().getDeptModel()也是返回一个List
没搞明白红色部分代码,就凭这一句就把数据加载进来。其内部机制到底是怎么回事哦,请求解答