| Author |
dynamic jtable
|
Prahlad Joshi
Ranch Hand
Joined: Apr 21, 2007
Posts: 44
|
|
|
i want to create a table whose column and row names will be entered at run time by the user(and hence the size will depend on the number of strings entered by him).
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8434
|
|
|
The DefaultTableModel provides all the functionality you require.
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
Ganesh Chinni
Greenhorn
Joined: Dec 30, 2005
Posts: 24
|
|
Just in case if you wanted a sample code to dynamically add rows to table, DefaultTableModel model; JTable table; model = new DefaultTableModel(); model.addColumn("Name"); model.addColumn("Phone"); table=new JTable(model); for(i=0;i<=5;i++) { Object[] rowData = {"XYZ","1236"}; model.insertRow(i,rowData); } Regards, Ganesh SCJP SCWCD SCBCD [ October 24, 2007: Message edited by: Ganesh Chinni ]
|
 |
 |
|
|
subject: dynamic jtable
|
|
|