[英]Adding JcomboBox in JTable
I have created a form in which I have added a jTable
which has 3 columns. 我创建了一个表单,其中添加了一个包含3列的
jTable
。 2nd and 3rd column have jcombobox
editor. 第2和第3列有
jcombobox
编辑器。
I want that when we select the first item of the 2nd column combobox first combobox of the 3rd column combobox should also be selected and vice-versa. 我希望当我们选择第二列组合框的第一项时,也应该选择第三列组合框的第一组合框,反之亦然。
How can I do that? 我怎样才能做到这一点?
您可以尝试覆盖public void setValueAt(Object aValue, int rowIndex, int columnIndex)
方法,并检查何时将值设置为已编辑的列,您还应该为第一列调用setValueAt()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.