Programming 12: Java Swing Project 1 – Adding Machine

AddingMachineYou will create a simple adding machine (i.e. a calculator that has only an adding function). The adding machine will have 12 buttons: 10 buttons for 0-9, one button for add (and equal), and one button for clear.

Click on the picture (right) to download a sample working adding machine.


  • Visual Design: 2 marks
  • Basic Functionality (i.e. yours does what the example does): 6 marks
    • number entry (0-9)
    • multidigit numbers
    • addition/equal
    • all clear
  • Key Listeners: 2 marks
    • 0 to 9 to enter numbers
    • + and Enter key to add
    • Esc to clear

Note: Use key listeners on the TextField to detect specific keyboard inputs. Click here for reference to Java key listeners in Swing UI.