示例#1
0
文件: View.java 项目: Looncall/MVC
  /** If a button is pressed... */
  @Override
  public void actionPerformed(ActionEvent event) {
    // TODO Auto-generated method stub
    for (int i = 0; i < 11; i++) {
      if (event.getSource() == numButtons[i]) {
        model.numberPress("" + i);
      }
    }

    for (int i = 0; i < functions.length; i++) {
      if (event.getSource() == funcButtons[i]) {
        model.functionPress(i);
      }
    }
    display.setText(model.getDisplay()); // Update the display
  }