Refresh data in JTable
hi, i hava a problem, i have a jtable where same Data column depend from another column of the same jtable and a jtextfield that is external to jtable
my jtable is
jcombobox | text | text | text ecc....
when the user change the SelectedItem of jcombobox the other column`s data is jacombobox values * external JtextField text....
if i change the value of the external jtextfield how can i refresh the data in the jtable whitout click over all cell?
this is the code of the My CellRender of the first column:
publicclass MyComboBoxRendererextends JComboBoximplements TableCellRenderer{
JTable jt;
PortataUgelli pug;
public MyComboBoxRenderer(String[] items,JTable table,PortataUgelli pu){
super(items);
this.jt=table;
this.pug=pu;
addItemListener(new java.awt.event.ItemListener(){
publicvoid itemStateChanged(java.awt.event.ItemEvent evt){
if (jt.getSelectedColumn()==0){//This action is only for the first column
String ugello= (String)getSelectedItem();
if (ugello==null) ugello=""+0;
double b=Double.parseDouble(pug.getPressione().trim());
String par="" +new VariID().getFunzioneUgelli(ugello,b);//this method calculate the value of the other cell
int sel;
if (jt.getSelectedRow() < 0) sel=0;
else sel = jt.getSelectedRow();
jt.setValueAt(par,sel,1);//set the value of the cell
}
}
});
}
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected,boolean hasFocus,int row,int column){
if (isSelected){
setForeground(table.getSelectionForeground());
super.setBackground(table.getSelectionBackground());
}else{
setForeground(table.getForeground());
setBackground(table.getBackground());
}
// Select the current value
setSelectedItem(value);
returnthis;
}
}

