我正在使用此代码添加JCombobox
到JTable
,但是当我运行此代码时,没有组合框被添加到Jtable
唯一的标题中显示在Jtable
.
Private JTable ScrollPaneTable;
public JTable getScrollPaneTable()
{
if(ScrollPaneTable == null)
{
try
{
ScrollPaneTable = new JTable();
ScrollPaneTable.setName("ScrollPaneTable");
getJScrollPane1().setColumnHeaderView(ScrollPaneTable.getTableHeader());
TableColumn sportColumn = ivjScrollPaneTable.getColumnModel().getColumn(0);
sportColumn.setCellEditor(new DefaultCellEditor(getCombo1())); //getCombo1
returns the JCombo box reference whose items are already added.
ScrollPaneTable.setBounds(0, 0, 200, 200);
}
catch(Throwable Exc)
{
handleException(Exc);
}
}
return ScrollPaneTable;
}
在这里,我只添加了一个组合,但我想在其他列中使用更多组合。