I have lots of JFrames with several components. They're generally built dynamically with all components added dynamically as well, but some are built manually.
Want I want: I want to add a new component, say a read-only JTextField, which prints information about the currently focused component in the JFrame. The purpose is to have a really easy way to see where each component fetches its data from (they're generally bound to fields from a database or to some method just returning the data they need) and other interesting stuff. Let's just call this the "DebugInfoComponent".
My current idea, which I feel is somewhat primitive: I could "just" add a FocusListener to every component of every JFrame, which then notifies the DebugInfoComponent, which then calls setText with the relevant information based on the component being focused.
My question: Is there a better way?