• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to update table model  RSS feed

 
chris uchime
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Please I know this page seems a lot old but its of much concern to me as I'm new to java. Please can I get the code that accomplishes the above tasks in the question i.e. Have a selected Jtable row display in a jtextfield and after update of the selected row, it automatically reflects the changes in the jtable row. Please anyone I await your reply, thank you.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.
I have split your question from the other topic. Please do not hijack other people's posts to ask your questions

We do not hand out ready made code . Tell us what you have tried so far , where you are stuck and we will help point you in the right direction
This should help you get started http://docs.oracle.com/javase/tutorial/uiswing/components/table.html
 
Sam Gooding
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
chris uchime wrote:Hi,
Please I know this page seems a lot old but its of much concern to me as I'm new to java. Please can I get the code that accomplishes the above tasks in the question i.e. Have a selected Jtable row display in a jtextfield and after update of the selected row, it automatically reflects the changes in the jtable row. Please anyone I await your reply, thank you.


A high level overview of a solution looks like:

1) implement a listener to the table that knows when that table row has changed.
2) that listener also has a reference to the textfield
3) when the table listener is notified that the table has changed , it updates the text field.

a more detailed but still high level solution looks like this:

create a TableModelListener which has a reference to the JTextField you want updated. You will attach this TableModelListener to the TableModel of the Table :





 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!