Aew galera, to precisando da ajuda de vcs... pesquisa em um monte de sites e inclusive aqui no GUJ, porem nenhum exemplo me ajudou... e até agora nao entendi bem como funciona...
Eu tenho um table Model e criei um Cell Editor tbm:
import java.awt.Component;
import javax.swing.AbstractCellEditor;
import javax.swing.JComboBox;
import javax.swing.JTable;
import javax.swing.table.TableCellEditor;
/**
*
*
*/
public class CellEditor extends AbstractCellEditor
implements TableCellEditor {
private JComboBox field;
private String[] values = {"1", "2"};
@Override
public Component getTableCellEditorComponent(JTable table,
Object value, boolean isSelected, int row, int column) {
field = new JComboBox(values);
return field;
}
@Override
public Object getCellEditorValue() {
return field.getSelectedItem().toString();
}
}
Metodo getValueAt do TableModel
@Override
public Object getValueAt(int linha, int coluna) {
NotaFiscalEntrada c = notafiscalent.get(linha);
Pessoa p = c.getFornecedor();
CellEditor ce = new CellEditor();
switch (coluna) {
case 0:
return c.getNNf();
case 1:
return p.getNome_razao();
case 2:
return Funcoes.DataSQLtoUtilString(c.getDataEmissao());
case 3:
return Funcoes.DataSQLtoUtilString(c.getDataChegada());
case 4:
return c.getValorTotal();
case 5:
return ce.getCellEditorValue();
default:
return null;
}
}
Alguem sabe como funciona?
[]'s

