Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

plz give code for row deletion !!  RSS feed

 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
cld any1 provide me a sample code for deleting/adding row in a JTable on Button Click..
i tried fireTableRowsDeleted() and removeRow() but cldnt find the result.. I found some examples storing the data in vector remving the vector data nd then populating the table..is there any other method..plz help me with some sample code..
thanks
raj
 
Abhik Sarkar
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Here is an extract from one of my programs. I have a custom TableModel derived from javax.swing.table.AbstractTableModel. The data in the TableModel is contained in an ArrayList.
The actual code is too large and hence I am unable to post the whole thing here. But I hope that this extract along with some idea/Javadoc of the JTable and TableModels will help you...

Note that calling fireTableDataChanged on a table with lot of data would be bad pratice. One should actually call :

[ June 27, 2003: Message edited by: Abhik Sarkar ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!