在MessageDialog中禁用按键 [英] Disable key-pressing in MessageDialog

查看:166
本文介绍了在MessageDialog中禁用按键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Java软件开发出了问题。用户必须在JtextPane中写入文本。当他没有时间写作时,会出现一个弹出窗口。
唯一的问题是:如果用户在弹出消息时正在写入,弹出窗口会消失,因为按下的键会验证消息。

I have a problem with my software developped in Java. The user has to write a text in a JtextPane. When there's no time left for him to write, a pop-up appears. The only problem is : if the user is writting when the message pops up, the pop-up disappears because the key pressed validate the message.

是否有无论如何我可以禁用这个功能?
我用它来创建MessageDialog:

Is there's anyway I can disable this fonction ? I use this to create the MessageDialog :

JOptionPane.showMessageDialog(null,
                new UTIL_LireFichierTXT().getText(MessageTempsImparti)
                ,new UTIL_LireFichierTXT().getText(MessageAttention),JOptionPane.WARNING_MESSAGE);

感谢您阅读。

推荐答案

禁用正常的应用程序行为(例如使用键操作对话框)不是一个好主意。它让许多用户感到困惑,他们已经被培养成期望在GUI中获得某些核心功能,而且对于残障用户来说这可能是一个真正的问题,他们可能需要使用键盘导航来代替鼠标。

Disabling normal application behaviour (such as manipulation of dialogs with keys) is not a great idea. It confuses a lot of users, who have been groomed to expect certain core functionality in GUIs, plus it can prove a real problem for users with disabilities, who may need to use keyboard navigation in place of a mouse.

我建议你考虑一种告诉用户时间到了的不同方法。也许在某个地方出现在应用程序上的横幅标签?

I would suggest you consider a different method of telling the user the time is up. Perhaps a banner label appearing on the application somewhere?

这篇关于在MessageDialog中禁用按键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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