Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个类 Dialog ,它封装了 window 类型org.aswing.Component。 我以focus()这种方式创建函数:
org.aswing.Component
focus()
public function focus() { if (Std.is(window, org.aswing.Component)) { var b = window.requestFocus(); } }
执行此函数后b为真(即请求有效)但没有触发事件处理程序。你能解释一下如何强制焦点设置吗?
b
容器(包括 JWindow)不能被聚焦。要确定组件是否可以聚焦,您应该使用以下内容
trace(component.isFocusable());
仔细看看http://doc.aswing.org/a3/
当您创建 JWindow 时,您可以传入 modal=true,这将确保 JWindow 始终位于顶部并防止用户访问其他 JWindows 中的组件。您也可以在创建 JWindow 后调用它的 setModal() 方法。