Question: Please add the code to include a small image at the top of the form of this JavaFX GUI(modify code as necessary): Band.java import javafx.application.Application;

Please add the code to include a small image at the top of the form of this JavaFX GUI(modify code as necessary):

Band.java

import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.layout.GridPane; import javafx.stage.Stage;

public class Band extends Application { final Alert a = new Alert(Alert.AlertType.NONE); final Label brandNameLbl = new Label("Name of Band: "); final RadioButton sample1 = new RadioButton("Sample 1"); final RadioButton sample2 = new RadioButton("Sample 2"); final CheckBox tus = new CheckBox("Tuesday"); final CheckBox fri = new CheckBox("Friday"); final CheckBox sat = new CheckBox("Saturday"); final Label numOfBundlesLbl = new Label("Sample sound clips of songs "); final TextField brandTxt = new TextField(""); final TextField brandPageTxt = new TextField(""); final TextField cont1Txt = new TextField(); final TextField cont2Txt = new TextField(); final Button submitBtn = new Button("Submit Audition"); final Button clearBtn = new Button("Clear form"); final Button extlBtn = new Button("Exit"); final Label totalPayLbl = new Label("Net Compensation:"); int rowStart = 5; int rowDiff = 2;

public static void main(String[] args) { launch(args); }

@Override public void start(Stage stage) { stage.setTitle("Band Info"); Scene scene = new Scene(new Group(), 600, 500);

GridPane grid = new GridPane(); grid.setVgap(4); grid.setHgap(10); grid.setPadding(new Insets(5, 5, 5, 5)); grid.add(brandNameLbl, 0, rowStart); grid.add(brandTxt, 1, rowStart);

rowDiff += rowDiff; grid.add(new Label("Band website or facebook page"), 0, rowStart+rowDiff); grid.add(brandPageTxt, 1, rowStart+rowDiff);

rowDiff += rowDiff; grid.add(numOfBundlesLbl, 0, rowStart + rowDiff); grid.add(sample1, 1, rowStart + rowDiff);

rowDiff += 1;

grid.add(sample2, 1, rowStart + rowDiff);

rowDiff += rowDiff; grid.add(new Label("Days of week youy are typically available for playing"), 0, rowStart + rowDiff); grid.add(tus, 1, rowStart + rowDiff); rowDiff += 1; grid.add(new Label("(check all that apply)"), 0, rowStart + rowDiff); grid.add(fri, 1, rowStart + rowDiff); rowDiff += 1; grid.add(sat, 1, rowStart + rowDiff);

rowDiff += 3; grid.add(new Label("Contact Name "), 0, rowStart + rowDiff); grid.add(cont1Txt, 1, rowStart + rowDiff); rowDiff += 1; grid.add(new Label("Contact Phone "), 0, rowStart + rowDiff); grid.add(cont2Txt, 1, rowStart + rowDiff); rowDiff += 3;

submitBtn.setMinWidth(150); grid.add(submitBtn, 0, rowStart + rowDiff); clearBtn.setMinWidth(150); grid.add(clearBtn, 1, rowStart + rowDiff); extlBtn.setMinWidth(100); grid.add(extlBtn, 2, rowStart + rowDiff);

totalPayLbl.setVisible(false); sample1.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { sample1.setSelected(true); sample2.setSelected(false); } }); sample2.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { sample2.setSelected(true); sample1.setSelected(false); } });

submitBtn.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { try { String msg = "The following information was successfully submitted : "; String name = brandTxt.getText(); msg += "Band : "+name +" "; String site = brandPageTxt.getText(); msg += "Website/ Facebook : "+site+" "; msg += "Sound clips were successfully uploaded "; msg += name+" are available to play on: "; if(tus.isSelected()) msg += "--Tuesday "; if(fri.isSelected()) msg += "--Friday "; if(sat.isSelected()) msg += "--Saturday "; msg += "Contact information: "+cont1Txt.getText()+" at "+cont2Txt.getText(); if(name.equals("")|| site.equals("") || cont1Txt.getText().equals("") || cont2Txt.getText().equals("")){ a.setAlertType(Alert.AlertType.ERROR); a.setTitle("Empty Input"); a.setContentText("Invalid Input, Please fill all fields"); a.show(); } else { a.setAlertType(Alert.AlertType.INFORMATION); a.setTitle("Successfully Submitted"); a.setContentText(msg); a.show(); cont2Txt.clear(); cont1Txt.clear(); sample1.setSelected(false); sample2.setSelected(false); fri.setSelected(false); tus.setSelected(false); sat.setSelected(false); brandPageTxt.clear(); brandTxt.clear(); } } catch (Exception ex) { a.setAlertType(Alert.AlertType.ERROR); a.setTitle("Invalid Input"); a.setContentText("Invalid Input, check the input field"); a.show(); } } }); clearBtn.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { cont2Txt.clear(); cont1Txt.clear(); sample1.setSelected(false); sample2.setSelected(false); fri.setSelected(false); tus.setSelected(false); sat.setSelected(false); brandPageTxt.clear(); brandTxt.clear(); } });

extlBtn.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { System.exit(0); } }); Group root = (Group) scene.getRoot(); root.getChildren().add(grid); stage.setScene(scene); stage.show(); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!