开发者

adding JComboBox to a jTable with specific data per row

I am trying to add a JComboBox to the last column of my JTable. The JComboBox isn't for editing purposes but for traversing the JTable itself. Each row can have 0-many elements that need to go in the JComboBox and when a value is selected from the box I need to scroll to a different row in the JTable.

All the research I have done points me specifically to editors and renderers with the down fall being that da开发者_JAVA技巧ta in the JComboBox is set per column so that a user can select a value for the cell in the row. Where as I need values that are specific to the row.

So my question is, has anyone tried to do this before? and Can you point me to some good information on how to do this? or even better could you describe how you did this?


1/ simple example here, your job is only to move (hold) TableCellEditor to the last row in the TableView,

2/ if JComboBox's Item changed then search in TableModel for TableRow (if every TableColumns ends with JComboBox)

3/ then call myTable.changeSelection(row, column, false, false);

4/ possible fauls implemented and used RowSorter, RowFilter, then you have to get int row from TableView and convert that to the TableModel by using

int modelRow = convertRowIndexToModel(row);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜