自己在写一个简单浏览器程序,大体已经实现,想添加一个安全模块,就是账号管理,在设置账号过程中,有各种问题,都已经解决,就最后一个问题,当出现 输入密码 和 确认密码不同的时候,我想账户界面窗口显示栏先显示两次输入不同,再将确定按钮设置为无法使用,接着让程序暂停5s在清空提示信息(即两次输入不同)和输入栏内所有输入,再使确认按钮可以使用,我自己代码如下,运行时每次一点确定按钮,程序立刻暂停,5s后才显示错误信息,怎么样才能让程序正常显示,求指点相关代码如下: comfirm为确认密码的JpasswordFieldd类对象 password为输入密码的JpasswordField对象 bok为确定按钮对象 pscp为错误信息显示窗口。 else if(change(comfirm.getPassword())!= change(password.getPassword())) {
pscp.setText("error:两次输入不同");
bok.setEnabled(false);
// System.out.println(3);
// try{
Thread.currentThread().sleep(4000);
}catch(Exception e3)
{
}
//System.out.println(change(password.getPassword()));
// System.out.println(change(comfirm.getPassword()));
password.setText(null);
comfirm.setText(null);
bok.setEnabled(true);
}
pscp.setText("error:两次输入不同");
bok.setEnabled(false);
// System.out.println(3);
// try{
Thread.currentThread().sleep(4000);
}catch(Exception e3)
{
}
//System.out.println(change(password.getPassword()));
// System.out.println(change(comfirm.getPassword()));
password.setText(null);
comfirm.setText(null);
bok.setEnabled(true);
}
解决方案 »
- JBuilder中的Project Properties打不开
- 关于urlrewriter的疑问,求教!!!
- jforum +eclipse 有经验者交流
- jsp连接Mysql数据库的问题
- 菜鸟问题 JSP
- 请问怎样实现用JSP上传图片到文件夹里!!祝大家中秋节快乐!!
- SESSION的怪问题 在线等
- hibernateTemplate进行更新的问题
- 谁有分离html的函数?
- 关于jspsmartupload与oracle的问题。
- SVN连接问题 Authentication realm:'<https://210.30.12.19:443>Subversion Repositories'
- JAVA
你的这种效果应该在页面上做的吧?
你在后台做根本没用,只能让页面加载返回结果时延迟加载而已。应该在页面用js设置"确认按钮"为disable.
用setInterval("yourfunction(){设置"确认按钮"为enable.}",5000);