A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Clearing data from a jTable
Joined: May 03, 2004
Dec 07, 2004 10:49:00
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??
Joined: Dec 07, 2004
Dec 07, 2004 15:03:00
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
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: Clearing data from a jTable
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014