I'm writing an application that uses CardLayout. The first card shows 3 buttons, Edit Add and Finish. The Edit and Add
cards have the same layout except for one place. Edit has a drop JComboBox showing current values for the application, Add has a JTextField that allows you to add a new value and submit it. Otherwise, the two
cards are identical.
I've played around with using inner classes (super and subclasses), duplicating all of the fields for each card, and using various types of logic to switch between the combobox and the textfield, but I either get some pretty funky results, or the code becomes so garbled as to be unreadable. Writing three separate classes would be nice, but since the application pulls values from all the fields, I haven't figured a way to do that yet (without passing an extremely lengthy list of parameters or adding extra objects to the application to get/set the values for the fields).
Anyone have an idea of how to approach this?
Thanks in advance,
Jason