Description Using JavaFX and any of its associated controls, create a Java GUI a
ID: 3606070 • Letter: D
Question
Description Using JavaFX and any of its associated controls, create a Java GUI application that recreates a physical interface. Examples include items like microwaves, calculators, ATMs, car radios, media players, or any other devices. You may choose any real-world object as long as you fulfill the listed requirements. Your program should use a minimum of: 5 UI Components (e.g. Button, Label, TextField, etc.) At least one component must be an Image combined with an ImageView. That combination counts as 1 of the 5 Ul components if used, e.g. 1 lmage with 1 ImageView counts as 1 of 5 components. o 3 different types of Panes At least one Pane must contain another Pane (e.g. FlowPane containing a VBox) o 1 bound property Node property customization (changing styles, colors, etc.) . Other requirements and notes: Your program should indicate, in the comment header, the object you are recreating. If the object you are using is not common, include a link to a representative picture. o You may not use any of the items represented in In-Class Assignment 1 A portion of your grade (up to 30%) will be based on how well the program represents the object you are emulating, within the limits of JavaFX. o Effective use of images will help fulfill this requirement o Any non-web-accessible images or other files that are used should be · zipped/emailed to chris williams@armstrong.edu. If I cannot run your program as submitted, it will not be graded (missing images or other resources that you have not sent to me). Sketching the object with detailed pane options will help you figure out which types of panes to use and where. This is a purely visual assignment; there is no interactive requirement. This assignment will NOT be auto-graded in Livelab. Livelab will only serve as the submission system for this assignment. Make sure you hit Save/Run/Compile to save your submission. . .Explanation / Answer
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Text;
import javafx.geometry.Orientation;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.Priority;
import javafx.stage.Stage;
public class GridPaneExample extends Application
{
@Override
public void start(Stage stage)
{
GridPane gridPane = new GridPane();
FlowPane flowpane = new FlowPane();
//Creating Components
Lablel l1=new Label("Enter your name");
TextField t1=new TextField(30);
Button button1 = new Button("microwaves");
Button button2 = new Button("calculators");
Button button3 = new Button("ATM");
Button button4 = new Button("Car radios");
Button button5 = new Button("Media players");
flowpane.getChildren().add(l1);
flowpane.getChildren().add(t1);
gridPane.add(button1 ,1,0);
gridPane.add(button2 ,0,1);
gridPane.add(button3 ,3,1);
gridPane.add(button4 ,3,2);
gridPane.add(button5 ,3,3);
flowpane.add(gridpane);
//Creating a scene object
Scene scene = new Scene(flowpane, 200, 100);
stage.setScene(scene);
stage.setTitle("GridPane Example 1");
stage.show();
}
public static void main(String[] args)
{
Application.launch(args);
}
}