Hi , Once u create and set a Model to the JTable, u must not set a new one each time..From the code below it seems u are setting the model after setting the column width. try this.. 1. Create table 2. Create the default table model and set the model to table 3. Set the table column width and renderers, editors if any..
Later on if u want to delete a selected row.. follow these ... 1. Get the model from the table ( (DefaultTableModel)table.getModel() ) 2. Get the data vector from model and delete the row - tableModel.getDataVector().remove(messageTbl.getSelectedRow()); 3. Fire the data changed event - tableModel.fireTableDataChanged(); Only this has to be done..do not set the model once again...u have the reference of model and just updating it is enough..i have tried it and is working.. - manoj Ruel Elvambuena To: [EMAIL PROTECTED] <dnoveno@hanj cc: [EMAIL PROTECTED], in.com> [EMAIL PROTECTED], Vikram Kumar <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 01/15/03 Subject: Re: JTable display problem 11:35 AM Tried using the code below but still doesn't work. messageTbl.setModel(tableModel); tableModel.getDataVector().remove(messageTbl.getSelectedRow()); tableModel.fireTableDataChanged(); Why on some of my codes that deals on JTable this problem doesn't occur? I'm stuck here. [EMAIL PROTECTED] wrote: >HI, > Try this... > > > -------------------------------------------------------------------------- >DefaultTableModel tableModel; >JTable table; > : > >tableModel.getDataVector().remove(index); // make any changes to the >model >tableModel.fireTableDataChanged(); > >regards, >Manoj > >Have tried it already after deleting a row and I also tried the >revalidate then repaint. But none of it solve the problem. > >Thanks. >Vikram Kumar wrote: > > >>try caling repaint on the table >> >>Ruel Elvambuena wrote: >> >> >>>What do I have to do to make my JTable refresh its view >>> >>> >automatically > > >>>whenever I delete a row? Currently if I delete a row I need to >>>resize any of its column in order to repaint/refresh its display. >>> >>>I'm using DefaultTableModel as my TableModel. >>> >>>Please help me. >>> >>>Regards+tia. >>> _______________________________________________ Advanced-swing mailing list [EMAIL PROTECTED] http://eos.dk/mailman/listinfo/advanced-swing