Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is a problem that need to create temperature converter GUI, I do write part of it but can't confusing about the rest part. Please
This is a problem that need to create temperature converter GUI, I do write part of it but can't confusing about the rest part. Please help me because this homework is due tommrow! Thanks!(Here is all the information and everything is clear, thanks!)
2
3
1. Complete the following code so that it generates the following temperature converter GUI. (6 pts) | | 3 Temperature Temperature emperature Converter emperature Converter emperature Converter Farenheit 85.5 Farenheit 104.00 Farenheit Celcius 29.72 Celcius 40 Celcius ] Lauri ConvertClea ConvertClear ConvertClear Fig 1: Enter Faren. press "Conver Fig 2: Enter Celcius. press "Convert" Fig 3: press "Clear" import javafx.scene.control import javafx.scene.control. Toxt Field, import javafx.scene.control import javafx.scene.layout.StackPane: import javafx.scene.layout.GridPane; import javafx.scene.layout. HBox; import javafx.geometry. Insets import javafx.geometry. Pos import javafx.event.ActionEvent: import javafx.event.EventHandler; import java.text.DecimalFormat; public class TempConverter extends GridPane private Label instruction, farenLabel, celciusLabel; private TextField tfFaren, tfcelcius; private Button convertBtn, clearBtn; //Constructor public TempConverter ) //Step 1 instantiate all instance variables instruction = new Label ("Temperature Converter"); farenLabe1 = new Label ("Farenheit"); celciusLabelnew Label ("Celcius" ' tfFaren new TextField(); tfCelcius new TextField); convertBtn = new Button ("Convert"); clearBtnnew Button ("Clear" //Create a GridPane and set its properties GridPane gridPanenew GridPane) gridPane.setAlignment (Pos. CENTER) gridPane.setPadding (new Insets (12, 12, 12, 12)); gridPane.setHgap (5); gridPane.setVgap (5) //(1)add labels and text fields inside gridPane gridlane .add Cinstruction , o,o) grid Pane add Cfaren Lolel, o arid Pan?. a nd Pne add t Falen, 1,1> /create a HBox which contains the two buttons jrirn HBox but t on Pane = new HBox (15); buttonPane.setPadding (new Insets (12, 12, 12, 12) buttonPane setAlignment (Pos.CENTER; // (2) add two buttons inside buttonPane button Panc addlCcovertta button Pane.add ( clearBtn // (3) TempConverter is a GridPane. Add the relevant GUI component inside //(4) register the source object with a nw handler object l //end of the constructor //step #2: The handler class private class TempHandler implements EventHandlerStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started