this will cause all components to transition inside your JFrame content panel and print them to the console:
public void listAllComponentsIn(Container parent)
{
for (Component c : parent.getComponents())
{
System.out.println(c.toString());
if (c instanceof Container)
listAllComponentsIn((Container)c);
}
}
public static void main(String[] args)
{
JFrame jframe = new JFrame();
listAllComponentsIn(jframe.getContentPane());
}
Dan o source
share