I'm trying to create what is essentially a modified version of a JTable, call it MyTable, for which I explicitly define the interface. My idea was to create MyTable as a wrapper for JTable, but suppose I want to show the underlying JTable on screen so that users can interact with it: How would I go about this? My first thought was to provide a getter for the JTable, but of course then I lose the safety of encapsulating it because someone can do aMyTable.getJTable().someUndesirableAction(). What is the best approach to take here?
Apologies if this is a silly question! Please feel free to tell me if I'm approaching this problem from the totally wrong angle, which I have a feeling I might be.
Aucun commentaire:
Enregistrer un commentaire