CardLayout or just adding and removing components

I need to provide some panel. But all the panels have common outlook. All the panels are divided into three parts. A label in the upper side (Only label string will be different for different panels), some buttons in the lower side (Common buttons for all panels, like "Prev", "Next", "Ok", "Cancel"), and in the middle a list box, or text area, or some other component. Now I think, I have two choice, one is to use CardLayout, and another choice, just removing and adding required components in the middle(Controlled by the buttons). Please tell me, which way will be more efficient and logical, or there might be better way.

[634 byte] By [ahmadleada] at [2007-10-2 10:21:19]
# 1

Have that whole thing wrapped as one Object. Have get and set methods for all the components. For the middle section I would suggest a cardLayout. provide the ability to set the desired card using a set method just like the other components.

I think this would be a better approach then manually adding and removing components. Adding and removing components can cause your GUI to jump about a bit. Each card however will be the same size regardless of the content so the GUI will be more solid.

Plus a card layout will be a much more managable design.

Just my 2 cents on the thing....

JNameNotTakena at 2007-7-13 1:52:13 > top of Java-index,Desktop,Core GUI APIs...