diff --git a/src/net/java/sip/communicator/impl/gui/utils/MasterPasswordInputDialog.java b/src/net/java/sip/communicator/impl/gui/utils/MasterPasswordInputDialog.java
index 066b7ad43..29d5a7ede 100644
--- a/src/net/java/sip/communicator/impl/gui/utils/MasterPasswordInputDialog.java
+++ b/src/net/java/sip/communicator/impl/gui/utils/MasterPasswordInputDialog.java
@@ -21,7 +21,8 @@
*/
public class MasterPasswordInputDialog
extends SIPCommDialog
- implements ActionListener
+ implements ActionListener,
+ KeyListener
{
/**
* Instance of this class.
@@ -106,6 +107,7 @@ private void initComponents()
// password fields
currentPasswdField = new JPasswordField(15);
+ currentPasswdField.addKeyListener(this);
currentPasswdField.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent arg0)
@@ -118,13 +120,12 @@ public void actionPerformed(ActionEvent arg0)
// OK and cancel buttons
okButton = new JButton(resources.getI18NString("service.gui.OK"));
- okButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic(
- "service.gui.OK"));
+ okButton.setMnemonic(resources.getI18nMnemonic("service.gui.OK"));
okButton.addActionListener(this);
cancelButton =
new JButton(resources.getI18NString("service.gui.CANCEL"));
- cancelButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic(
+ cancelButton.setMnemonic(resources.getI18nMnemonic(
"service.gui.CANCEL"));
cancelButton.addActionListener(this);
@@ -206,12 +207,47 @@ protected void close(boolean escaped)
/**
* Resets the password by clearing the input field and setting
- * password to null.
+ * password to null. Disables the OK button.
*/
private void resetPassword()
{
password = null;
currentPasswdField.setText("");
currentPasswdField.requestFocusInWindow();
+ okButton.setEnabled(false);
+ }
+
+ /**
+ * Disables OK button if the password input field is empty.
+ *
+ * @param event key event
+ */
+ public void keyReleased(KeyEvent event)
+ {
+ JPasswordField source = (JPasswordField) event.getSource();
+ if (currentPasswdField.equals(source))
+ {
+ String password = new String(currentPasswdField.getPassword());
+ okButton.setEnabled(password.length() > 0);
+ password = null;
+ }
+ }
+
+ /**
+ * Not overriding.
+ *
+ * @param arg0 key event
+ */
+ public void keyPressed(KeyEvent arg0)
+ {
+ }
+
+ /**
+ * Not overriding.
+ *
+ * @param arg0 key event
+ */
+ public void keyTyped(KeyEvent arg0)
+ {
}
}
diff --git a/src/net/java/sip/communicator/plugin/securityconfig/masterpassword/MasterPasswordChangeDialog.java b/src/net/java/sip/communicator/plugin/securityconfig/masterpassword/MasterPasswordChangeDialog.java
index ce5f24f22..ee97d1fcf 100644
--- a/src/net/java/sip/communicator/plugin/securityconfig/masterpassword/MasterPasswordChangeDialog.java
+++ b/src/net/java/sip/communicator/plugin/securityconfig/masterpassword/MasterPasswordChangeDialog.java
@@ -192,10 +192,13 @@ public void actionPerformed(ActionEvent e)
// OK and cancel buttons
okButton = new JButton(resources.getI18NString("service.gui.OK"));
+ okButton.setMnemonic(resources.getI18nMnemonic("service.gui.OK"));
okButton.addActionListener(this);
okButton.setEnabled(false);
cancelButton
= new JButton(resources.getI18NString("service.gui.CANCEL"));
+ cancelButton.setMnemonic(resources.getI18nMnemonic(
+ "service.gui.CANCEL"));
cancelButton.addActionListener(this);
passwordQualityBar =