reading values from JTable  
Author Message
metzger





PostPosted: 2005-5-19 4:52:00 Top

java-programmer, reading values from JTable I am looking for a working example of a JTable that is constructed
with initial values in the cells, allows the user to change those values,
and reads the values out.

I've got three books on Swing, none of them show a write/read table.

I have no problem creating tables with nothing in some cells, and
reading the values out that the user entered.

Here is how I construct the tables:

DefaultTableModel model01= new DefaultTableModel(rowData,colNames);
JTable table01= new JTable(model01);

Any help greatly appreciated.
--
Robert Metzger
Hewlett-Packard Company
High Performance Computing Division
 
Dag Sunde





PostPosted: 2005-5-19 5:41:00 Top

java-programmer >> reading values from JTable "Robert Metzger" <email***@***.com> wrote in message
news:d6g9u1$email***@***.com...
> I am looking for a working example of a JTable that is constructed
> with initial values in the cells, allows the user to change those values,
> and reads the values out.
>
> I've got three books on Swing, none of them show a write/read table.
>
> I have no problem creating tables with nothing in some cells, and
> reading the values out that the user entered.
>
> Here is how I construct the tables:
>
> DefaultTableModel model01= new DefaultTableModel(rowData,colNames);
> JTable table01= new JTable(model01);
>

Extend/implement AbstractTableModel, and implement getValueAt(),
setValueAt() and
isCellEditable()...

http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

--
Dag.