Question

I can set data in JTable constructor, and then user can change this data when program is running manually(typing from keyboard).

But what method should I use in case I want to change data in some column? To change column header I use TableColumn method setHeaderValue. What should I use to set value in JTable cell?

Was it helpful?

Solution

If you want to allow users to edit the data, then you need to set a TableCellEditor on the cells that you want people to edit. You probably also want to start using a TableModel instead of hard coding the data in the JTable itself.

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

OTHER TIPS

While creating the JTable you first need to specify that the values of particular column are editable. You can obviously also provide the row basis edit functionality. but all these things you should define while ccreating the table itself. Please reply if you need any help on this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top