只是一个简单的问题,如果我保持大写锁定它会出现警告消息 3 次?我只希望它出现一次
jButton1.addActionListener(new ActionListener() {
@SuppressWarnings("deprecation")
public void actionPerformed(ActionEvent evt) {
for( int i=0; i < users.size(); i++ ){
temp = (logins)users.elementAt(i);
if( Toolkit.getDefaultToolkit().
getLockingKeyState(KeyEvent.VK_CAPS_LOCK))
{
check = "true";
{
JOptionPane.showMessageDialog(
null, "Please turn off the capslock", "Error",
JOptionPane.ERROR_MESSAGE );
}
}
}
}
});
pack();
this.setSize(643, 434);
}
catch (Exception e) {
e.printStackTrace();
}
}
}