In my Swing app, I have a POJO class called Command. Command has a few subclasses. Most of the Command subclasses consist of 2 or 3 Strings. But the data in one of the Command subclasses has a fairly different data format.
I also have a class called CommandEditor, which creates the GUI for viewing and editing the various Command subclasses. CommandEditor creates a JPanel that contains a horizontal Box. For the Command subclasses that contain 2 or 3 Strings, the Box contains 2 or 3 corresponding JTextFields. And for the odd subclass, the Box contains the appropriate widgets for viewing and editing that subclass's data.
I am able to put together a form that contains a bunch of CommandEditors, and it all works nicely.
But now I need to deal with an ArrayList of Commands. All of the Commands in the ArrayList are guaranteed to be of the same subclass, which means that the corresponding CommandEditors for each of the Commands will look basically the same (having a similar shape)
What the customer wants is something that looks like a table of CommandEditors.
What's the best way to do this? Can I pass a Vector of CommandEditor objects into a JList (such that the JList puts the CommandEditors into rows, and the CommandEditors provide the illusion of having columns)? Or is there a better way?