This is basically a architectural question.
I want to implement composite pattern in handling Swing components; that is, I want to combine several components with their listeners and logic behind a single component for easier handling.
Consider for example a simple directory browser; say, a JTree in JScrollPane with some logic which handles populating filenames as user expands JTree nodes. How would you implement that?
Do you extend JScrollPane and add JTree and so on in constructor, and then your application deals with JScrollPaneExtended class? Or do you extend, say, JPanel or JComponent? Or do you stitch all those classes together in a method you call when you're populating your JFrame? Or something else? And why?
I'm basically looking for a rough guideline on what others use; I'd obviously like to deal with some form of JComponent for easier handling in constructing GUI, however somehow it doesn't feel right to extend topmost component (JScrollPane in this example) just to have someplace to put glue code.