• Post Reply Bookmark Topic Watch Topic
  • New Topic

Updating an object from one class in another one

 
Adrian Lukaszek
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Guys. I have quite a riddle how to update object from one class in another one. More precisely I've got a JTable in one JFrame (wchich is obviously editable and might have different amount of rows as well) and want to import data from it to a Jtable which is located in another JFrame. The question is rather overall since I don't know how to refresh Integer neither Thanks in advance

 
Les Morgan
Rancher
Posts: 717
17
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you truly want to access one from the other, all you need do is add a reference to the object: You can do this with a parent object or in a 3rd object that has a reference to each and utilizing a setter in each class.
 
Adrian Lukaszek
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is pretty clear for me. But I want to see changes in an object in the class C2 when object from class C1 is changed by user while program is working.
 
Les Morgan
Rancher
Posts: 717
17
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try it.
Adrian Lukaszek wrote:This is pretty clear for me. But I want to see changes in an object in the class C2 when object from class C1 is changed by user while program is working.
 
Les Morgan
Rancher
Posts: 717
17
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here ya go.

Adrian Lukaszek wrote:This is pretty clear for me. But I want to see changes in an object in the class C2 when object from class C1 is changed by user while program is working.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!