|
-
October 21st, 1999, 06:32 AM
#1
really need an example of default table model ...
Help. I am stuck.
I want to implement a JTable which can addrows to it.
From
http://java.sun.com/products/jfc/swi...ableModel.html
only contain the API.
i have look around but still cannot find any examples.
import java.util.Vector;
//import javax.swing.*;
//import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.event.TableModelEvent;
what should i put inside this class ?
public class TModel extends DefaultTableModel {
Vector data = new Vector();
}
http://members.xoom.com/lookads
-
October 21st, 1999, 08:36 AM
#2
Re: really need an example of default table model ...
Hi newkid ,
What's problem with the one i gave ?????
http://codeguru.developer.com/bbs/wt...va&Number=3264
insert "import java.util.Vector" "import javax.swing.event.TableModelEvent" in
the import statement part. If you face any problem post a question or if you want
something else , please elaborate.
Poochi....
-
October 21st, 1999, 08:47 PM
#3
just need some example on default table model that can add and delete rows ..
yes. thanks for the code. but, i thought some of you really could come up with some code that can add and delete rows.
http://members.xoom.com/lookads
-
October 21st, 1999, 09:12 PM
#4
Re: just need some example on default table model that can add and delete rows ..
I dont know what you are really looking for. If you want to add a row in your
JTable, get TableModel and type cast it to DefaultTableModel and then call addRow(..).
To delete a row , call removeRow(.. ).
Ex :
// Add a row
((DefaultTableModel)table.getModel()).addRow( vector );
// Delete a row
((DefaultTableModel)table.getModel()).removeRow( nRowIndex );
By default , DefaultTableModel is the table model for all JTable. If you set the Model
to your own Model , then you have to implement all these stuffs( add , remove ..) in your
TableModel class.
Poochi...
-
October 23rd, 1999, 01:27 AM
#5
Re: just need some example on default table model that can add and delete rows ..
how does the whole file look like . well, i really need to get it fast and could not afford to read up on the java books.
really appreciated some java code. hopefully a working demo.
thanks a lot again.
http://members.xoom.com/lookads
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|