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...
-
Raven Finance Company experiences bad debts of about 3% of its outstanding loans. At the end of the year, the company had outstanding receivables of $18 million. This balance included $2 million of...
-
The immobilized enzyme layer shown in the figure below is designed to convert substrate A to product B according to the simplified reaction A B with simplified rate equation R A = kc A . In this...
-
An effective way to learn how companies respond to the competing pressures to be globally integrated and locally responsive is to study them in action. Referring back to Exhibit 6.3, search online...
-
(Settlement of Debt) Strickland Company owes $200,000 plus $18,000 of accrued interest to Moran State Bank. The debt is a 10-year, 10% note. During 2010, Stricklands business deteriorated due to a...
-
What type of failure has occurred when a new-product introduction loses money for the company when accounting for development, marketing, and production costs?
-
The Accounts Receivable Confirmation Statistics working paper shown on the next page was prepared by an audit assistant for the 2013 audit of Lewis County Water Company, Inc., a continuing audit...
-
Determine what sub-networks will be required to meet the following requirements. Record all calculations/reasoning in the Observations section for this part of the lab. Include a description -...
-
Navigate to the threaded discussion below and make a post that answers the following: Based on the above information from the Federal Reserve, explain where you believe the country is at this point...
-
Which policy model describes the public policy decision-making as a process characterized by bargaining and compromise among self-interested decision-makers? Explain in detail..
-
1. Brief Description of the Community, Geographic Location, Boundaries and History/Indigenous History 2. Key Demographics and Analysis 1. 2. 3. 4. 5. 3. Community Assets ENVIRONMENTAL CAPITAL...
-
From a height of 2.0 m a 0.500 kg ball is dropped and bounces up to a height of only 1.5 m. How much energy was changed into heat by the drop?
-
In the state of Florida, the intestate succession statute elects an estate executor through probate court, if there isn't a will in place. The next of kin is selected. The next of kin starts with a...
-
The production data for a gas field are given below Piz (psia) G. MMM SCF) 0.393 6553 6468 1.642 6393 3.226 6329 4.260 6246 5.504 6136 7.538 6080 8.749 Assuming a volumetric behavior calculate the...
-
A company pledges their receivables so they may Multiple Choice Charge a factoring fee. Increase sales. Recognize a sale. Collect a pledge fee. Borrow money. Failure by a promissory notes' maker to...
-
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...
-
In a large office building, there is a woman dead in her locked office, sitting at her desk. Except for the desk, chair, and contents on the desk, the office is empty and the air conditioner is...
-
How many birthdays does the average person have?
-
A murderer is condemned to death. He has to choose between three rooms. The first is full of raging fires, the second is full of assassins with loaded guns, and the third is full of lions that havent...
Study smarter with the SolutionInn App