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

查看:290
本文介绍了在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天全站免登陆