你能创建一个不可关闭,不可解决的Java应用程序吗? [英] Can you make an uncloseable, unleavable, Java application?

查看:157
本文介绍了你能创建一个不可关闭,不可解决的Java应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法确保用户无法关闭或离开我的Swing应用程序?我试图将它全屏显示,但你仍然可以使用Alt-Tab远离它 - 此外,当你决定使用JOptionPane的对话框时,这不会很好。



<那么,有没有办法让用户在设备上只使用这一个Java程序?



编辑:有些人想知道这个目的。该应用程序应该被嵌入手持设备(在Windows下运行),因此设备的用户将使用它,因为我们打算使用它 - 例如,他们不会玩Freecells或做更糟糕的是,而不是做实际的工作。你看过售票亭了吗?他们被锁定得很好,你不能只关闭他们华而不实的GUI并进入Windows桌面!

解决方案

好的@Daniel向您展示了如何通过调用以下方式使Java应用程序无法关闭(+1给他):



JFrame #setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE <; code>



JFrame 实例。



确保你不能离开它,即按 CTRL + ALT + DEL ALT + TAB 等你可能想这样做(仅适用于windows):



1)禁用TaskManager / CTRL + ALT + DEL by:




  • 设置注册表key:


    HKCU / Software / Microsoft / Windows / CurrentVersion / Policies / System / DisableTaskMgr = 1


    通过reg脚本或cmd.exe。




2 )要像<一样禁用所有快捷方式kbd> ALT + TAB 等参见这里(下载/使用 * .reg 脚本并通过 cmd 执行)。


Is there a way to make sure that a user cannot close or leave my Swing application? I've tried to make it fullscreen, but you can still Alt-Tab away from it—and besides, that doesn't work well when you decide to use JOptionPane's dialogs.

So, is there any way to make a user use only this one Java program on a device?

Edit: Some people wonder about the purpose. The application is supposed to be sorta "embedded" into the handheld device (which runs under Windows), so the users of the device will use it as we intend it to be used—for example, that they won't play Freecells or do something worse instead of doing the actual work. Have you seen ticketing kiosks? They are locked down pretty well, you can't just close their big flashy GUI and get to the Windows desktop!

解决方案

Okay @Daniel showed you how to make a Java app un-closeable (+1 to him) by calling:

JFrame#setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

on the JFrame instance.

To make sure you cant leave it i.e by pressing CTRL+ALT+DEL and ALT+TAB etc you may want to do this (applies to windows only):

1) Disable TaskManager/CTRL+ALT+DEL by:

  • Setting registry key:

    HKCU/Software/Microsoft/Windows/CurrentVersion/Policies/System/DisableTaskMgr = 1

    via reg script or cmd.exe.

2) To disable all shortcuts together like ALT+TAB etc see here (Download/use the *.reg script and execute it via cmd).

这篇关于你能创建一个不可关闭,不可解决的Java应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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