Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Create an Interactive JavaFX Application (3 points):
- Create an application with the following controls:
- A Label control with the following text displayed: "First Number:"
- A Label control with the following text displayed: "Second Number:"
- An empty TextField control beside the First Number label.
- An empty TextField control beside the Second Number label.
- Five buttons:
- Button 1 labeled +
- Button 2 labeled -
- Button 3 labeled *
- Button 4 labeled /
- Button 5 labeled =
- An empty Label control that will display the result of a mathematical operation.
- Make sure there is spacing between each control.
- Align the controls:
- The Label control with the text First Number on the first line with a TextField beside it.
- The buttons labeled +, -, *, / on the second line. Make sure there is space between the buttons.
- The Label control with the text Second Number on the third line with a TextField beside it.
- The button labeled = on the fourth line.
- The label that will contain the result of the operation on the fifth line.
- Make sure the window is large enough to display all controls.
- Create an event for each button:
- Capture the text entered in the first TextField control. Note that values in a TextField are strings. You will need to convert it to a numeric value.
- Capture the text entered in the second TextField control. Note that values in a TextField are strings. You will need to convert it to a numeric value.
- Perform the mathematical operation indicated by the button being pressed.
- When the = button is pressed display the result of the calculation in the results label.
- The order of execution for the user is as follows. Your program must respond in this order:
- Enter a value in the first TextField.
- Click on an operation button.
- Enter a value in the second TextField.
- Click on the equals button.
- View the result in the Label control.
- Display the window.
- Submit your source code as a plain text file(s) with a .java extension.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement