Package calculator

Class CalculatorController

java.lang.Object
calculator.CalculatorController
All Implemented Interfaces:
ActionListener, TextListener, EventListener

public class CalculatorController extends Object implements TextListener, ActionListener
This class represents the controller in the MVC architecture for a calculator application. It handles all the listener event from view and perform operation using model.
Since:
24 Aug 2023
Version:
1.0.0
Author:
Shamith Nakka
  • Field Details

  • Constructor Details

    • CalculatorController

      public CalculatorController()
      Constructs a new CalculatorModel instance. This constructor initializes any required data or resources.
    • CalculatorController

      public CalculatorController(CalculatorView view, CalculatorModel model)
      Constructs a new CalculatorModel instance. This constructor initializes with provided data or resources.
      Parameters:
      view - : a CalculatorView instance.
      model - : a CalculatorModel instance.
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent event)
      This is an event-handler will handle all the button events.
      Specified by:
      actionPerformed in interface ActionListener
    • textValueChanged

      public void textValueChanged(TextEvent event)
      This is an event-handler that make sure only numeric character are present within the text field.
      Specified by:
      textValueChanged in interface TextListener