Exemplo n.º 1
0
 @Override
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == backButton) {
     EventBus.publish(new Event(Event.Tag.GO_TO_MAIN, 1));
   } else if (e.getSource() == saveButton) {
     if (balanceField.getText().equals("")) {
       error1Label.setText("You have no information to save");
       error2Label.setText("");
     } else if (!(passwordField.getText().equals(password))) {
       error1Label.setText("");
       error2Label.setText("Incorrect password");
     } else {
       error2Label.setText("");
       error1Label.setText("");
       Account a = new Account("", "", username, password);
       a.getBalance().addToBalance(Integer.parseInt(balanceField.getText()));
       EventBus.publish(new Event(Event.Tag.ACCOUNT_CHANGED, a));
     }
   }
 }
Exemplo n.º 2
0
 public AccountPanel() {
   init();
   EventBus.register(this);
 }