JDesktopPane - 如何获得活动框架 [英] JDesktopPane - how to get active frame

查看:32
本文介绍了JDesktopPane - 如何获得活动框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得 JDesktopPane 内的活动(有焦点)框架 (JInternalFrame)?我的 MDI 记事本需要它(不是任何人都会使用它,只是一个培训项目).查看 api,我只看到获取所有 JInternalFrames 的函数,而不是活动的函数.

How to get active (having focus) frame (JInternalFrame) that is inside JDesktopPane? I need it for my MDI notepad (not that anybody would use that, just a training project). Looking at api, I see only functions to get all JInternalFrames, not active one.

推荐答案

使用 JDekstopPane.getSelectedFrame() 方法(来自文档:此 JDesktopPane 中当前活动的 JInternalFrame,如果当前没有活动的 JInternalFrame,则为 null.)或 JDesktopPane.getAllFrames() 获取当前显示在桌面上的所有 JInternalFrames 列表并检查 isSelected() 方法.

Use JDekstopPane.getSelectedFrame() method (From doc: currently active JInternalFrame in this JDesktopPane, or null if no JInternalFrame is currently active.) or JDesktopPane.getAllFrames() to get list of all JInternalFrames currently displayed in the desktop and check isSelected() method.

这篇关于JDesktopPane - 如何获得活动框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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