Merge pull request #28 from scribblemaniac/fix-start-button

I noticed a few situations when the start button would be enabled or disabled at the wrong times. The changes I made should correct the following issues:

    If you type your username and then paste password from the clipboard, the start button will remain disabled despite both the username and passwords being filled. This is because pasting does not trigger the keyTyped event. To fix this I simply moved the checkDisplaySaveButton call to the keyReleased event, which is called by pasting and regular typing.
    When the client initially starts, the start button is enabled even if the username or password field is empty. To fix this I added a call to checkDisplaySaveButton before the button was added to the content pane.
This commit is contained in:
Laurent Clouet
2015-07-12 20:21:05 +01:00

View File

@@ -214,6 +214,7 @@ public class Settings implements Activity {
n += sep; n += sep;
saveButton = new JButton("Start"); saveButton = new JButton("Start");
checkDisplaySaveButton();
saveButton.setBounds(start_label_right, n, 80, size_height_label); saveButton.setBounds(start_label_right, n, 80, size_height_label);
saveButton.addActionListener(new SaveAction()); saveButton.addActionListener(new SaveAction());
parent.getContentPane().add(saveButton); parent.getContentPane().add(saveButton);
@@ -393,11 +394,11 @@ public class Settings implements Activity {
@Override @Override
public void keyReleased(KeyEvent arg0) { public void keyReleased(KeyEvent arg0) {
checkDisplaySaveButton();
} }
@Override @Override
public void keyTyped(KeyEvent arg0) { public void keyTyped(KeyEvent arg0) {
checkDisplaySaveButton();
} }
} }