Crawler needs to detect new additions to code base

I have Java code that has front end(Java Swing) elements and other code. I need to document every front end element in a JSON file. How can I do that?

The front end look something like this:


This could go upto 7 levels and I want my JSON to save this relationship. Also, the software must be able to detect new front end elements that have been added between two runs of the software and automatically add it to the JSON at the right place.

Appreciate all the help I can get.