Swing中如何设置默认打开窗口?
我有一个应用程序,对于两种不同类型的应用程序用户有两个不同的登录窗口,比如说一个是客户端,另一个是管理员,现在我想要一个选项在两个登录
窗口上设置默认打开窗口,例如一个复选框
,其标签为设置这是您的默认登录窗口..
我怎样才能实现这个目标?
我可以使用 .properties
文件来设置默认窗口吗? (以及如何?)
或者,首先加载并决定首先加载的默认 GUI 窗口的 Main.java
类?
我更喜欢第二种方式......但欢迎您的意见,也请提供一些示例代码来完成此任务。
I have an application that has two different login windows for two different types of users of application, say one is client and the other is administrator , now i want to have an option on both the Login
windows to set the default opening window, something like a checkbox
having label as set this is as your default Login window ..
How can i achieve this??
May i use a .properties
file to set the default window? (and How?)
Or, a Main.java
class which loads first and decides the default GUI window to load first??
I preferred the 2nd way...but your views are welcomed, also please provide some example codes to accomplish this task.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在两个登录窗口上添加 JCheckbox。当用户成功登录时,查找复选框的值,使用以下方法设置首选项:
当您加载应用程序时:
add a JCheckbox on both login windows. When the user logs in succesfully, look up the value of the checkboxes, set a preference using:
When you load your application: