0
只是一個簡單的問題,如果我把大寫鎖定在它上面會出現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();
}
}
}
爲了儘快提供更好的幫助,請發佈[SSCCE](http://sscce.org/)。 – 2013-02-23 16:31:30
*「Warning message 3 times」* users.size()'的值是多少?我敢打賭它有3個元素。 – 2013-02-23 16:33:30