I have this code to get all the elements I need and do some processing. The problem is I need to specify every panel I have to get the elements inside it.
fo
Look at the doc for JFrame. Everything you put in a JFrame is actually put in a root pane contained in the frame.
JFrame
for (Component c : this.getRootPane().getComponents())