Bernhard Haeussermann wrote:
I think there are pro's and cons. In the second version of the GUI class, as I've mentioned before, one can include methods for the client that manipulate the JFrame. The problem here is that the client will have to call methods on the JFrame object to do some things and methods on the GUI object to do some other things.
Of course, when extending JFrame, one needs to be careful of accidentally overriding methods of JFrame. I cannot recall, however, that something like that has ever happened to me. If you use good descriptive names for your methods, this is unlikely to happen.
As for the issue of needing to change the JFrame into a JDialog or JPanel - would this change necessarily be more work when GUI extends JFrame? When I think about it, I'm not quite sure. I would need to try actually doing it for both versions of the GUI class.