Swings become visible frames

How can I find all visible frames / dialogs in the program? I could subclass the JFrame / JDialog classes to update the list of currently visible windows, but if there is a built-in solution for this, it will be much better

+4
source share
2 answers

Try

List<Window> visibleWindows = new ArrayList<Window>(); for(Window w: Window.getWindows()){ if(w.isShowing()){ visibleWindows.add(w); } } 

Literature:

+11
source

Extension to Moonbeam Response . Additionally you can say:

Toolikit.getDefaultToolkit().addAWTEventListener()

... and subscribe to all events related to the window. In this case, you will receive information that the window is created immediately.

+2
source

All Articles