Question: This is a java program please type it, it will be more helpfull Create a simple calculator application that adds two numbers. The purpose of
This is a java program please type it, it will be more helpfull
Create a simple calculator application that adds two numbers. The purpose of this assignment is to explore UI elements and event listeners.
Create a single class to hold your main instance, which will instantiate a JFrame and attach an instance of your CalculatorPanel class.
Create the CalculatorPanel class. This class should resize the main panel (itself) and create two sub-panels, each sized so they will fit side-by-side.
Into the left panel, add two text boxes (with labels) and a button.
Into the right panel add three labels, as shown below.
Add a listener to each of the textboxes so that when a person presses 'Enter', the label on the right panel updates.
Add a listener to the 'Calculate' button so that when a person presses it, the total updates.
For this assignment, you can safely assume that the calculate button is only pressed when there are values assigned.
When the button is clicked, it should look like this:
For 5% extra credit, attach the same event listener class to both textboxes (hint: pass a reference to the target label to the constructor).

Create a simple calculator application that adds two numbers. The purpose of this assignment is to explore UI elements and event listeners. Create a single class to hold your main instance, which will instantiate a UErame and attach an instance of your el class Create the culat class. This class should resize the main panel (itself and create two sub-panels, each sized so they will fit side-by-side. Into the left panel, add two text boxes (with labels) and a button. Into the right panel add three labels. as shown below. Dumb Calculator First Value: First Value: Second Value: Second Value: Total Calculate Add a listener to each of the textboxes so that when a person presses 'Enter', the label on the right panel updates. Add a listener to the 'Calculate' button so that when a person presses it, the total updates. For this assignment, you can safely assume that the calculate button is only pressed when there are values assigned When the button is clicked, it should look like this: Dumb Calculator First Value: 5 First Value: 5 Second Value: 3 Second Value 3 Total: 8 Calculate For 5% extra credit, attach the same event listener class to both textboxes (hint: pass a reference to the target label to the constructor
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
