最好的方法是在你想修改的时候,只修改TableModel的值,CellEditor根据TableModel的值而进行改变。
不过如果你一定要按你的方法直接添加的话,你可以调用JTable的
TableCellEditor getCellEditor(int row, int column)
把这个Editor造型成ComboBox然后给它添加内容。
另外得到选中的行,很简单
int getSelectedRow()
Returns the index of the first selected row, -1 if no row is selected.
int getSelectedRowCount()
Returns the number of selected rows.
int[] getSelectedRows()
Returns the indices of all selected rows.
不过如果你一定要按你的方法直接添加的话,你可以调用JTable的
TableCellEditor getCellEditor(int row, int column)
把这个Editor造型成ComboBox然后给它添加内容。
另外得到选中的行,很简单
int getSelectedRow()
Returns the index of the first selected row, -1 if no row is selected.
int getSelectedRowCount()
Returns the number of selected rows.
int[] getSelectedRows()
Returns the indices of all selected rows.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货