Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can someone please comment this on what the javafx do and how they are implement

ID: 3830015 • Letter: C

Question

 Can someone please comment this on what the javafx do and how they are implemented?  import javafx.application.Application; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.paint.Paint; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javafx.stage.Stage;  public class TextPanel extends Application {      GridPane grid = null;     Text scenetitle = null;      Label tDrawLabel = null;     Label bsc345Label = null;     HBox THBox = null;     VBox mVBox = new VBox(2);     Stage primaryStage = null;      @Override     public void start(Stage primaryStage) {          this.primaryStage = primaryStage;          grid = new GridPane();          grid.setAlignment(Pos.CENTER);         grid.setHgap(5);         grid.setVgap(5);         grid.setPadding(new Insets(20, 5, 20, 5));          mVBox.setStyle("-fx-padding: 10;"                 + "-fx-border-style: solid inside;" + "-fx-border-width: 2;"                 + "-fx-border-insets: 5;" + "-fx-border-radius: 5;"                 + "-fx-border-color: blue;");         scenetitle = new Text("Text Draw");         scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));         grid.add(scenetitle, 1, 1, 1, 1);          THBox = new HBox(4);           tDrawLabel = new Label("TextDraw");         tDrawLabel.setFont(new Font("Arial", 20));         //textDrawLabel.setSpacing(10);         tDrawLabel.setPadding(new Insets(0, 40, 10, 40));                  THBox.getChildren().add(tDrawLabel);          mVBox.getChildren().add(THBox);         bsc345Label = new Label("BSC 345");         bsc345Label.setFont(new Font("Arial", 80));         mVBox.getChildren().add(bsc345Label);          primaryStage.setTitle("");         Scene scene = new Scene(mVBox, 375, 225);         primaryStage.setScene(scene);         primaryStage.show();     }      /**      * @param args      * the command line arguments      */     public static void main(String[] args) {         launch(args);     } } 

Explanation / Answer

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Paint;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class TextPanel extends Application {

GridPane grid = null;   //Creates a GridPane object, and is initialized to null.
Text scenetitle = null;   //Creates a Text object, and is initialized to null.

Label tDrawLabel = null;   //Creates a Label object, and is initialized to null.
Label bsc345Label = null;   //Creates another Label, and is initialized to null.
HBox THBox = null;           //Creates a HBox(Horizontal Box) object, and is initialized to null.
VBox mVBox = new VBox(2);   //Creates a VBox(Vertical Box) object, and is initialized with a set or 2 VBoxes.
Stage primaryStage = null;   //Creates a Stage object and is initialized to null.

@Override
public void start(Stage primaryStage) {

this.primaryStage = primaryStage;   //Creates a primaryStage.

grid = new GridPane();           //Creates a new GridPane.

grid.setAlignment(Pos.CENTER);   //grid is supposed to have center alignment.
grid.setHgap(5);   //grid is supposed to have horizontal gap of 5, between columns.
grid.setVgap(5);   //grid is supposed to have vertical gap of 5, between rows.
grid.setPadding(new Insets(20, 5, 20, 5));   //Sets padding of specified values to grid.

mVBox.setStyle("-fx-padding: 10;"
+ "-fx-border-style: solid inside;" + "-fx-border-width: 2;"
+ "-fx-border-insets: 5;" + "-fx-border-radius: 5;"
+ "-fx-border-color: blue;"); //Sets style of VBox object with specified values.
scenetitle = new Text("Text Draw");       //Initializes sceneTitle with a Text object.
scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));//Sets the font of the text with specified values.
grid.add(scenetitle, 1, 1, 1, 1); //Adds the Text object to grid.

THBox = new HBox(4);   //Creates a horizontal Box of size 4, and is initialized to THBox.


tDrawLabel = new Label("TextDraw");   //Creates a Label titled TextDraw.
tDrawLabel.setFont(new Font("Arial", 20));   //Sets the font of Label with specified values.
//textDrawLabel.setSpacing(10);
tDrawLabel.setPadding(new Insets(0, 40, 10, 40));   //Sets the padding values for the label.
  
THBox.getChildren().add(tDrawLabel);   //Lays out tDrawLabel as child of THBox.

mVBox.getChildren().add(THBox);   //Lays out THBox as child of mVBox.
bsc345Label = new Label("BSC 345");   //Creates a new Label with specified value.
bsc345Label.setFont(new Font("Arial", 80));   //Sets the font of the label.
mVBox.getChildren().add(bsc345Label);

primaryStage.setTitle("");   //Sets the title of primaryStage.
Scene scene = new Scene(mVBox, 375, 225);   //Creates vertical box with specified values.
primaryStage.setScene(scene);   //Sets the scene to primaryStage.
primaryStage.show();   //Shows the primaryStage.
}

/**
* @param args
* the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}