通过许多教程,我终于达到了可以用表格(JFrame)做很多事情的地步,但是我现在有2个JCombo盒子。我想只有1(最后一个),第一列应该只是用户输入..我怎么能有效地改变这个? 这是整个代码: https://pastebin.com/XR3Pgqij
只是一个片段:
// Create a combo box for season
JComboBox jcboSeason = new JComboBox();
jcboSeason.addItem("Spring");
jcboSeason.addItem("Summer");
jcboSeason.addItem("Autumn");
jcboSeason.addItem("Winter");
// Set combo box as the editor for the season column
TableColumn seasonColumn = myJTable.getColumn("Trash");
seasonColumn.setCellEditor(
new DefaultCellEditor(jcboSeason));
// Create a combo box for sport
JComboBox jcboSport = new JComboBox();
jcboSport.addItem("n.v.t.");
jcboSport.addItem("1");
jcboSport.addItem("2");
jcboSport.addItem("3");
// Set combo box as the editor for the sport column
TableColumn sportColumn = myJTable.getColumn("Debiteurennummer");
sportColumn.setCellEditor(
new DefaultCellEditor(jcboSport));
}