By completing this Lab, you will practice using JavaFX to create a Graphical User Interface (GUI)...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
By completing this Lab, you will practice using JavaFX to create a Graphical User Interface (GUI) and employ event-driven programming. Name your Eclipse project Lab3FirstNameLastName. Conversion Calculator Appearance (15 pts) Design and create a GUI that looks similar to Figure 1 below: Conversion Calculator Centimeters 0.0 Meters 0.0 Inches Yards 0.0 Figure 1. Initial GUI before a user's interaction. Create the class Conversion Calculator. The GUI has Labels, Buttons, and TextFields. The GUI uses a combination of VBOX, HBox, and GridPane. Set the title of the GUI to "Conversion Calculator". Clear Calculate Exit Set the initial value of TextFields to 0.00. • Do your best to make the GUI look as similar as possible to the examples provided. Some method hints are provided at the bottom of the lab for this. CS161 Introduction to Computer Science II Conversion Calculator Events (15 pts) Implement the following event handling methods to convert units, clear data, and exit the application: Calculate The user can enter a number into the "Inches" TextField and click the "Calculate" Button. ● ● Using the following equations, convert the entered length to other units and display them on their corresponding TextFields. 1 inch 2.54 cm 1 inch = 0.0278 yards 0.01 meters 1 cm Centimeters: 0.0 ● Meters: 0.0 = Conversion Calculator = Centimeters: 25.40 Meters: 0.25 Conversion Calculator All values must be rounded to two decimal places and then displayed. For example, when the user enters 10 in the Inches TextField: Inches: 10 Yards: 0.0 or or or Inches: 10 1 cm 1 yd 1 m Yards: 0.28 = = .3937 inches 36 inches After clicking the Calculate button, the results are rounded to 2 decimal places and displayed: = 100 cm Clear Calculate Exit X Clear Calculate Exit X Note: only calculate using the inches value. If you want, you can disable the other TextFields from manual entry using setEditable (false) for each of them. It will make the other TextFields appear slightly greyed out, which is fine. CS161 Introduction to Computer Science II Clear Exit When the "Clear" Button is clicked, replace the contents of the TextFields with "0.0": ● Conversion Calculator Centimeters: 0.0 Meters: 0.0 Conversion Calculator Centimeters: 106.05 Inches: 0.0 Meters: 1.06 Yards: 0.0 A second example: when the user enters 41.75 in the Inches TextField and clicks the "Calculate" button, the conversions are displayed as the following: Inches: 41.75 Yards: 1.16 Clear Calculate Exit When the "Exit" Button is clicked, exit the application. X Clear Calculate Exit CS161 Introduction to Computer Science II Hints: ● Use a combination of HBox, VBox, and GridPane to achieve the layout of the controls. If the controls are sized strangely and very close together, you can adjust using a few methods that are available for most controls: Submit: O set PrefSize(double prefWidth, double prefHeight) Forces the size of the control to be a specific amount of pixels if possible. Use this on Labels, TextFields, and Buttons that you want to look more uniform. I used a (prefWidth, prefHeight) of (230, 45) for each Label+TextField area and (80, 15) for each Button. You can use different values as long as it looks similar. setPadding(new Insets(int padding)) Puts white space (or padding) around the control. Use this on the GridPane to give it some space from the window border. o setHgap(int gap) Puts white space between horizontal controls in a GridPane. Use this on the GridPane to give some space between the different groups of controls. Submit the entire zipped Eclipse project folder containing Lab3 to Brightspace. All source code should be properly documented. By completing this Lab, you will practice using JavaFX to create a Graphical User Interface (GUI) and employ event-driven programming. Name your Eclipse project Lab3FirstNameLastName. Conversion Calculator Appearance (15 pts) Design and create a GUI that looks similar to Figure 1 below: Conversion Calculator Centimeters 0.0 Meters 0.0 Inches Yards 0.0 Figure 1. Initial GUI before a user's interaction. Create the class Conversion Calculator. The GUI has Labels, Buttons, and TextFields. The GUI uses a combination of VBOX, HBox, and GridPane. Set the title of the GUI to "Conversion Calculator". Clear Calculate Exit Set the initial value of TextFields to 0.00. • Do your best to make the GUI look as similar as possible to the examples provided. Some method hints are provided at the bottom of the lab for this. By completing this Lab, you will practice using JavaFX to create a Graphical User Interface (GUI) and employ event-driven programming. Name your Eclipse project Lab3FirstNameLastName. Conversion Calculator Appearance (15 pts) Design and create a GUI that looks similar to Figure 1 below: Conversion Calculator Centimeters 0.0 Meters 0.0 Inches Yards 0.0 Figure 1. Initial GUI before a user's interaction. Create the class Conversion Calculator. The GUI has Labels, Buttons, and TextFields. The GUI uses a combination of VBOX, HBox, and GridPane. Set the title of the GUI to "Conversion Calculator". Clear Calculate Exit Set the initial value of TextFields to 0.00. • Do your best to make the GUI look as similar as possible to the examples provided. Some method hints are provided at the bottom of the lab for this. CS161 Introduction to Computer Science II Conversion Calculator Events (15 pts) Implement the following event handling methods to convert units, clear data, and exit the application: Calculate The user can enter a number into the "Inches" TextField and click the "Calculate" Button. ● ● Using the following equations, convert the entered length to other units and display them on their corresponding TextFields. 1 inch 2.54 cm 1 inch = 0.0278 yards 0.01 meters 1 cm Centimeters: 0.0 ● Meters: 0.0 = Conversion Calculator = Centimeters: 25.40 Meters: 0.25 Conversion Calculator All values must be rounded to two decimal places and then displayed. For example, when the user enters 10 in the Inches TextField: Inches: 10 Yards: 0.0 or or or Inches: 10 1 cm 1 yd 1 m Yards: 0.28 = = .3937 inches 36 inches After clicking the Calculate button, the results are rounded to 2 decimal places and displayed: = 100 cm Clear Calculate Exit X Clear Calculate Exit X Note: only calculate using the inches value. If you want, you can disable the other TextFields from manual entry using setEditable (false) for each of them. It will make the other TextFields appear slightly greyed out, which is fine. CS161 Introduction to Computer Science II Conversion Calculator Events (15 pts) Implement the following event handling methods to convert units, clear data, and exit the application: Calculate The user can enter a number into the "Inches" TextField and click the "Calculate" Button. ● ● Using the following equations, convert the entered length to other units and display them on their corresponding TextFields. 1 inch 2.54 cm 1 inch = 0.0278 yards 0.01 meters 1 cm Centimeters: 0.0 ● Meters: 0.0 = Conversion Calculator = Centimeters: 25.40 Meters: 0.25 Conversion Calculator All values must be rounded to two decimal places and then displayed. For example, when the user enters 10 in the Inches TextField: Inches: 10 Yards: 0.0 or or or Inches: 10 1 cm 1 yd 1 m Yards: 0.28 = = .3937 inches 36 inches After clicking the Calculate button, the results are rounded to 2 decimal places and displayed: = 100 cm Clear Calculate Exit X Clear Calculate Exit X Note: only calculate using the inches value. If you want, you can disable the other TextFields from manual entry using setEditable (false) for each of them. It will make the other TextFields appear slightly greyed out, which is fine. CS161 Introduction to Computer Science II Clear Exit When the "Clear" Button is clicked, replace the contents of the TextFields with "0.0": ● Conversion Calculator Centimeters: 0.0 Meters: 0.0 Conversion Calculator Centimeters: 106.05 Inches: 0.0 Meters: 1.06 Yards: 0.0 A second example: when the user enters 41.75 in the Inches TextField and clicks the "Calculate" button, the conversions are displayed as the following: Inches: 41.75 Yards: 1.16 Clear Calculate Exit When the "Exit" Button is clicked, exit the application. X Clear Calculate Exit CS161 Introduction to Computer Science II Clear Exit When the "Clear" Button is clicked, replace the contents of the TextFields with "0.0": ● Conversion Calculator Centimeters: 0.0 Meters: 0.0 Conversion Calculator Centimeters: 106.05 Inches: 0.0 Meters: 1.06 Yards: 0.0 A second example: when the user enters 41.75 in the Inches TextField and clicks the "Calculate" button, the conversions are displayed as the following: Inches: 41.75 Yards: 1.16 Clear Calculate Exit When the "Exit" Button is clicked, exit the application. X Clear Calculate Exit CS161 Introduction to Computer Science II Hints: ● Use a combination of HBox, VBox, and GridPane to achieve the layout of the controls. If the controls are sized strangely and very close together, you can adjust using a few methods that are available for most controls: Submit: O set PrefSize(double prefWidth, double prefHeight) Forces the size of the control to be a specific amount of pixels if possible. Use this on Labels, TextFields, and Buttons that you want to look more uniform. I used a (prefWidth, prefHeight) of (230, 45) for each Label+TextField area and (80, 15) for each Button. You can use different values as long as it looks similar. setPadding(new Insets(int padding)) Puts white space (or padding) around the control. Use this on the GridPane to give it some space from the window border. o setHgap(int gap) Puts white space between horizontal controls in a GridPane. Use this on the GridPane to give some space between the different groups of controls. Submit the entire zipped Eclipse project folder containing Lab3 to Brightspace. All source code should be properly documented. CS161 Introduction to Computer Science II Hints: ● Use a combination of HBox, VBox, and GridPane to achieve the layout of the controls. If the controls are sized strangely and very close together, you can adjust using a few methods that are available for most controls: Submit: O set PrefSize(double prefWidth, double prefHeight) Forces the size of the control to be a specific amount of pixels if possible. Use this on Labels, TextFields, and Buttons that you want to look more uniform. I used a (prefWidth, prefHeight) of (230, 45) for each Label+TextField area and (80, 15) for each Button. You can use different values as long as it looks similar. setPadding(new Insets(int padding)) Puts white space (or padding) around the control. Use this on the GridPane to give it some space from the window border. o setHgap(int gap) Puts white space between horizontal controls in a GridPane. Use this on the GridPane to give some space between the different groups of controls. Submit the entire zipped Eclipse project folder containing Lab3 to Brightspace. All source code should be properly documented.
Expert Answer:
Answer rating: 100% (QA)
Heres a basic outline of the ConversionCalculator class in JavaFX to get you started java import javafxapplicationApplication import javafxgeometryIns... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
What am I required to do in this assignment? Shared Power is an information system to help tradesmen share expensive and specialist tools rather than buying them themselves. Registered owners add...
-
Two bars AB and BC of negligible weight are attached to a single spring of constant k that is unstretched when the bars are horizontal. Determine the range of values of the magnitude P of two equal...
-
Use the rate-of-return data for the stock and bond funds presented in Spreadsheet 6.1, but now assume that the probability of each scenario is as follows: severe recession: .10; mild recession: .20;...
-
What would be the value of a savings account started with $1740 , earning 4 percent (compounded annually) after 16 years? (Round your answer to the nearest whole number. Do not include the comma,...
-
Robert Ryan practiced accounting with a partnership for five years. Recently he opened his own accounting firm, which he operates as a professional corporation. The name of the new entity is Robert...
-
1. How do information technologies contribute to the business success of Sew What? Inc.? Give several examples from the case regarding the business value of information technology that demonstrate...
-
What are Societal Movements Affecting the Development of Social Work Practice What are Professional Values of Social Work Practice What are Six Core Values of Social Work Practice What are Ethical...
-
Natasha's Flowers, a local florist, purchases fresh flowers each day at the local flower market. The buyer has a budget of $1000 per day to spend. Different flowers have different profit margins, and...
-
Wet steam in an autoclave can be caused by the placement of cold instruments in a hot chamber. Wet steam in an autoclave can be caused by the placement of cold instruments in a hot chamber. True False
-
To receive credit for you answers you must use the format explained in the midterm review, sample exam question review and in the announcements. When you find an issue in the case you must state it...
-
How have cultural and historical factors influenced taxonomic classification? Provide examples of how regional or historical biases have shaped taxonomic decisions and the efforts to correct them .
-
1 What is modeling? Why is data modeling essential to database design and development? 2 Describe the specific steps you must perform when constructing a data model. As an example, suppose you are...
-
Epson produces color cartridges for inkjet printers. Suppose cartridges are sold to mail-order distributors for $5.20 each. Total fixed costs per year are $820,800. Variable cost per unit are $1.85...
-
Goldratt (author of The Goal) applies his theory of constraints to the field of project management. He focuses on three phenomena that tend to bias the expected the expected completion time of...
-
8. [1.5] The ground-state electron configuration of B is (10)(10*)(20)(20*)(2). a. b. C. d. e. What is the number of unpaired electrons in the state? What is the maximal total spin of the molecule?...
-
Express these numbers in standard notation. a. 2.87 10-8 b. 1.78 1011 c. 1.381 10-23
-
The symbol is often used to denote the area under the standard normal curve that lies to the left of a specified value of z. Consider a one-mean z-test. Denote z0 as the observed value of the test...
-
On Thursday, June 13, 1996, then Arizona Governor Fife Symington was indicted on 23 counts of fraud and extortion. Just hours after the federal prosecutors announced the indictment, several polls...
-
How important are birdies (a score of one under par on a given golf hole) in determining the final total score of a woman golfer? From the U.S. Women's OpenWeb site, we obtained data on number of...
-
Winfred Metal Reclamation Ltd, a small company, buys scrap metal residues from local companies and treats the residues to recover the metal which is then sold to other local companies. The company is...
-
What financial statements must be prepared?
-
Mainbrace Ltd is a book publisher and retailer which trades via the Internet. The company was formed using a kit bought from a legal stationer, start up capital was provided by the major shareholder,...
Study smarter with the SolutionInn App