在 Java 应用程序中获取任何/所有活动的 JFrame? [英] Get Any/All Active JFrames in Java Application?

查看:16
本文介绍了在 Java 应用程序中获取任何/所有活动的 JFrame?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从 Java 应用程序中列出屏幕上可见的所有当前打开/活动(我不确定这里的术语)JFrames?感谢您的帮助.

Is there a way from within a Java application to list all of the currently open/active (I'm not sure the terminology here) JFrames that are visible on screen? Thanks for your help.

推荐答案

Frame.getFrames() 返回所有帧的数组.

Frame.getFrames() returns an array of all frames.

或者如@mKorbel 提到的那样,Window.getWindows() 将返回所有窗口 - 因为 Frame (& JFrame) 扩展 Window 将提供所有框架,然后是一些.有必要迭代它们以发现哪些当前可见.

Alternately as mentioned by @mKorbel, Window.getWindows() will return all windows - since Frame (& JFrame) extend Window that will provide all frames, and then some. It will be necessary to iterate them to discover which ones are currently visible.

这篇关于在 Java 应用程序中获取任何/所有活动的 JFrame?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆