简体   繁体   English

NetBeans平台应用-窗口控件

[英]NetBeans Platform App - Window control

I'm learning the NetBeans Platform and I've gone through a few tutorials and started working on a app. 我正在学习NetBeans平台,并且已经完成了一些教程并开始开发应用程序。 I've implemented the login tutorial with some changes which include 3 levels of access for a text editing application. 我已经通过一些更改实现了登录教程,其中包括对文本编辑应用程序的3个访问级别。 The access levels are User, Admin, and None. 访问级别为用户,管理员和无。 Based on access level different options will be available. 根据访问级别,将提供不同的选项。 If the user has None, then I want to stop the window from opening and instead present a dialog indicating they don't have permission to use the module. 如果用户没有任何内容,那么我想停止打开窗口,而是显示一个对话框,指示他们无权使用该模块。 I can't figure out how to keep the window from loading. 我不知道如何防止窗口加载。 The permissions check is within the top component constructor but I don't know how to make the window self-close. 权限检查在顶部组件构造函数中,但是我不知道如何使窗口自动关闭。

I tried doing an immediate return from the constructor but that leaves an empty tab in the editor area. 我尝试从构造函数中立即返回,但这在编辑器区域中留下了一个空白选项卡。 I've tried this.close(), variations on trying to get the WindowManager, etc., with no luck. 我已经尝试过this.close(),尝试获取WindowManager的变体等等,但是没有运气。

How can I make the window either not open or close immediately? 如何使窗口无法立即打开或关闭?

Call this.close() in the componentActivated() method of the top component. 在顶部组件的componentActivated()方法中调用this.close() Make sure to call super.componentActivated(); 确保调用super.componentActivated(); before calling this.close() 在调用this.close()之前

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM