Create the following graphical user interface (GUI) using JavaFX. Please note th
ID: 665951 • Letter: C
Question
Create the following graphical user interface (GUI) using JavaFX. Please note there will be NO FUNCTIONALITY in this GUI. It is ONLY the display. Nothing will happen when you click the buttons Scene/Pane Title should be Feet Meter GU Convert er GUI box should be displayed in the center of the screen. GUI box should not be resizable. Padding should be 15px on top & bottom, 20px on left & right. Horizontal gap should be 10. Vertical gap should be 12. Background should be light salmon FFA07A rgb(255, 160, 122) Part I- Background of Convert to Feet button should be yellow /FFFF00 rgb(255, 255, 0) Part II- Background of Convert to Meters button should be burlywood DEB887 rgb(222, 84, 135) Output should be almost exactly like this: Feet Meter GUI Converter Enter a distance in meters: Convert to Feet Enter a distance in feet: Convert to Meters Your Eclipse project must be named as follows: YourFirstName YourLastName ab05. For example, if I were to submit the project, the folder name would be mary oberer Lab05. Zip t e entire project and submit the zipped file in the drop box by the deadline. Points may be deducted if submitted incorrectly. You should check to be sure the correct assignment was submitted and that it was correctly zipped.Explanation / Answer
Answer:
Code:
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
// www. j a v a 2 s . c o m
public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) {
Scene scene = new Scene(new Group(), 450, 250);
TextField notification = new TextField ();
notification.setText("Label");
Button btn = new Button();
Button btn1= new Button();
btn.setText("Convert to meter");
btn1.setText("Convert to feet");
btn.setFill(color.yellow);
btn1.setFill(color.burlywood)
notification.clear();
GridPane grid = new GridPane();
grid.setVgap(4);
grid.setHgap(10);
grid.setPadding(new Insets(5, 5, 5, 5));
grid.add(new Label("Enter distance in feet: "), 0, 0);
grid.add(notification, 1, 0);
grid.add(new Label("Enter distance in meter: "), 0, 0);
grid.add(notification, 1, 0);
Group root = (Group) scene.getRoot();
root.getChildren().add(grid);
stage.setScene(scene);
stage.show();
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.