+ //Get all Swing/AWT primitive components in the views and add them to the panel.
+ ArrayList<Component> components = new ArrayList<>();
+ for (int i = 0; i < panel.getComponentCount(); i++) {
+ if ((panel.getComponent(i) instanceof Container)) {
+ Container subContainer = (Container) panel.getComponent(i);
+ for (int j = 0; j < subContainer.getComponentCount(); j++) {
+ components.add(subContainer.getComponent(j));
+ }
+ }
+ }
+ for (Component component : components) {
+ panel.add(component);
+ }