Write a JavaFX application that converts from pounds tokilograms or kilograms to pounds. Include a pair of
Question:
Write a JavaFX application that converts from pounds tokilograms or kilograms to pounds. Include a pair of radiobuttons to indicate the direction of the conversion, and a pair oftext fields (with appropriate labels) to allow input of thenumbers. Also include a "Convert" button, a "Clear" button, and aempty label where error messages can be displayed if necessary.
By default, the "Pounds to Kilograms" radio button should beselected. Whichever radio button is selected, the other textfield should be set as not editable. For example when the"Pounds to Kilograms" radio button is selected, the kilograms textfield should be uneditable. Also, whenever either radiobutton is clicked, both text fields and the error label should becleared of text.
Of course, the user's input is received as text and must beparsed to a double. If the user's input cannot be beconverted (because it is non-numeric), an exception will be thrownwhen the input is parsed. Catch the exception and output anappropriate error message in the label at the bottom of thescene.
Helpful hint:The controls can be laid out inrows by using HBoxes, although a GridPane will work better for theTextFields and their associated labels. The verticalalignment can achieved by placing the HBoxes and GridPane in anouter VBox.
Conversion Factor: 1 pound = 0.4535924kilograms