I have three classes one is a JFrame and other two are JPanel . The class A has a JTable and i need to access the JTabel selected item in another class. Is that possible to get the selected item using the model? Or how to access the JTable in class B?
I have three classes one is a JFrame and other two are JPanel .
Share
Just because you are working with a Swing GUI does not change any of the rules of good object-oriented program techniques. You will need to give classes provide means of communicating with each other, perhaps by getter or setter methods, but you will want to limit this communication to be done with the least exposure necessary to maintain encapsulation/data hiding.