我在 aJComboBox
中JTable
,但是当我插入带有新值的新行时JComboBox
,所有行的所有JComboBox
s 都具有该值。如何JComboBox
为第三列中的每一行设置不同的值?我试过这段代码:
cc = new JComboBox();
cc.addItem(jComboBox5.getSelectedItem()+"/"+jComboBox6.getSelectedItem()+"/"+jComboBox7.getSelectedItem()+" "+jComboBox1.getSelectedItem()+"."+jComboBox2.getSelectedItem());
DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
renderer.setToolTipText("CLICCA PER LE DATE");
Object[][] stringa = {{jTextField1.getText(), jTextField2.getText(),jTextField3.getText()}};
model.addRow(stringa[0]);
int n=model.getRowCount();
for(int i=0; i<n;i++){
if(i==n-1){
//HERE HOW CAN I CHOOSE THE ROW WHERE PUT THIS JCOMBOBOX? BECAUSE WITH THIS CODE I CHANGE THE VALUES OF ALL COMBOBOXES WITH NEW VALUES
jTable1.getColumnModel().getColumn(3).setCellEditor(new DefaultCellEditor(cc));
jTable1.getColumnModel().getColumn(3).setCellRenderer(renderer);}
}
但是,我很抱歉大声喊叫。