我正在尝试使用 ComboBoxes 编辑我的 JTable 中某个列的单元格的内容。因此,我只需使用 JTables 官方 Java 教程 (http://download.oracle.com/javase/tutorial/uiswing/components/table.html) 中的代码。相关代码最终看起来像这样:
tableModel = new NetworkTableModel(columnNames,0,0);
networkTable = new JTable(tableModel);
....
TableColumn sendingColumn = networkTable.getColumnModel().getColumn(3);
JComboBox sendingBox = new JComboBox();
sendingBox.addItem("Sending");
sendingBox.addItem("Receiving");
sendingColumn.setCellEditor(new DefaultCellEditor(sendingBox));
问题是当我单击该列中的单元格时,组合框不会出现。我完全能够编辑单元格,但只能通过输入它们。为什么组合框不显示?