I have a package, which contains a lot of java swing components all of them extend a range of different JSwing components. In a separate file I want to access all of these components and put them into an ArrayList
?
I can do it in any way i want but i do not see how i could get it from looping through every file and I also do not know how to do it if I import it into an ArrayList dynamically.
For example:
-MyComponentsPackage
-Component1 (This extends JLabel)
-Component2 (This extends JButton)
-...
in another file I need to do:
private List<JComponent> = new ArrayList<JComponent>();
I want to be able to loop through every object and add them to a JPanel:
for (Component componentInPackage : allComponentsInPackage) {
myPanel.add(componentInPackage);
}