File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clearing data from a jTable

 
Jamie Wool
Ranch Hand
Posts: 49
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there an easy way to clear all data from a jTable. I've tried the table.removeAll(), which seemed sensible, but doesn't work.

Also how do you extract a value from a cell into a variable??
 
Vijay Raj
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use these methods of DefaultTableModel

1. setDataVector(Vector newData, Vector columnNames)
-- If you want the clear the exisitng contents of the table, pass a empty data vector

2. getValueAt (int row, int column)
-- This method returns the value present in a cell

You can also write your own model by extending AbstractTableModel
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic