Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How can I get this JavaFX GUI to display in a JSP? package pkgfinal; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import

How can I get this JavaFX GUI to display in a JSP?

package pkgfinal;

import javafx.application.Application;

import javafx.event.ActionEvent;

import javafx.event.EventHandler;

import javafx.scene.Scene;

import javafx.scene.control.Button;

import javafx.scene.layout.StackPane;

import javafx.stage.Stage;

import javafx.scene.text.*;

import javafx.application.*;

import javafx.embed.swing.SwingNode;

import javafx.event.ActionEvent;

import javafx.event.EventHandler;

import javafx.scene.shape.*;

import javafx.stage.*;

import javafx.scene.*;

import javafx.scene.control.ChoiceBox;

import javafx.scene.control.Hyperlink;

import javafx.scene.control.Label;

import javafx.scene.control.Menu;

import javafx.scene.control.MenuBar;

import javafx.scene.control.MenuItem;

import javafx.scene.control.ScrollPane;

import javafx.scene.control.TextField;

import javafx.scene.effect.DropShadow;

import javafx.scene.paint.Color;

import java.awt.Checkbox;

import java.io.FileNotFoundException;

import javax.swing.JComponent;

import javax.swing.JFrame;

import javax.swing.JInternalFrame;

import javax.swing.JMenu;

import javax.swing.JMenuBar;

import javax.swing.JMenuItem;

import javafx.scene.image.Image;

import javafx.scene.image.ImageView;

public class Final extends Application{

//contains all of the components to build the gui

public void start(Stage primaryStage) throws FileNotFoundException {

Rectangle header1=new Rectangle(0, 0, 1350,150);

Rectangle footer1=new Rectangle(0, 900, 1350, 150);

MenuBar mainMenu = new MenuBar();

Menu home=new Menu("HOME");

Menu aQuote=new Menu("GET A QUOTE");

MenuItem auto=new MenuItem("Automobile");

Menu bc=new Menu("Business & Commercial");

MenuItem one=new MenuItem("General Liability Quote Form");

MenuItem two=new MenuItem("Business Owners (BOP) Quote Form");

MenuItem three=new MenuItem("Workers Compensation Form");

bc.getItems().addAll(one, two, three);

MenuItem farm=new MenuItem("Farm");

Menu homeown=new Menu("Homeowners");

MenuItem a=new MenuItem("Homeowners Quote Form");

MenuItem b=new MenuItem("Homeowners Flood Quote Form");

homeown.getItems().addAll(a, b);

MenuItem life=new MenuItem("Life");

MenuItem vehic=new MenuItem("Recreational Vehicle");

aQuote.getItems().addAll(auto, bc, farm, homeown, life, vehic);

Menu customer=new Menu("CUSTOMER SERVICE");

Menu autos=new Menu("Automobile");

MenuItem id=new MenuItem("Request ID Card for Auto Policy");

MenuItem add=new MenuItem("Add Vehicle to Existing Auto Policy");

MenuItem remove=new MenuItem("Remove Vehicle from Existing Auto Policy");

MenuItem drive=new MenuItem("Add Driver to Existing Auto Policy");

autos.getItems().addAll(id, add, remove, drive);

Menu bus=new Menu("Business & Commercial");

MenuItem id1=new MenuItem("Request ID Card for Commercial Auto Policy");

MenuItem add1=new MenuItem("Add Vehicle to Existing Commercial Auto Policy");

MenuItem remove1=new MenuItem("Remove Vehicle from Existing Commercial Auto Policy");

MenuItem drive1=new MenuItem("Add Driver to Existing Commercial Auto Policy");

MenuItem drive2=new MenuItem("Remove Driver from Existing Commercial Auto Policy");

bus.getItems().addAll(id1, add1, remove1, drive1, drive2);

Menu homeow=new Menu("Homeowners");

customer.getItems().addAll(autos, bus, homeow);

Menu claims=new Menu("CLAIMS");

MenuItem auto1=new MenuItem("Automobile");

MenuItem bc1=new MenuItem("Business & Commercial");

MenuItem home2=new MenuItem("Homeowners");

claims.getItems().addAll(auto1, bc1, home2);

Menu payment=new Menu("MAKE A PAYMENT");

Menu resources=new Menu("RESOURCES");

MenuItem gloss=new MenuItem("Insurance Glossary");

MenuItem link=new MenuItem("Important Links");

MenuItem calc=new MenuItem("Calculators");

resources.getItems().addAll(gloss, link, calc);

Menu about=new Menu("ABOUT US");

MenuItem ab=new MenuItem("About Bluestem Insurance Group, LLC");

MenuItem loc=new MenuItem("Our Location");

MenuItem priv=new MenuItem("Privacy Policy");

about.getItems().addAll(ab, loc, priv);

Menu contact=new Menu("CONTACT US");

mainMenu.getMenus().addAll(home, aQuote, customer, claims, payment, resources, about, contact);

mainMenu.prefWidthProperty().bind(primaryStage.widthProperty());

//mainMenu.setScaleX(1.54);

//mainMenu.setScaleY(1.5);

mainMenu.setTranslateY(120);

Text home1=new Text(150,145,"HOME");

home1.setScaleX(1.2);

home1.setScaleY(1.2);

home1.setFont(Font.font("Maiandra GD",14));

Hyperlink quote1=new Hyperlink ("GET A QUOTE");

quote1.setTranslateX(250);

quote1.setTranslateY(127);

quote1.setScaleX(1.2);

quote1.setScaleY(1.2);

quote1.setFont(Font.font("Maiandra GD",14));

// quote1.setOnAction(e->GetaQuote.main(null));

/* quote1.setOnAction(new EventHandler() {

public void handle(ActionEvent event) {

Application.launch(GetaQuote.class);

}

});*/

//quote1.setOnMouseClicked(event->Application.launch(GetaQuote.class));

Text customer1=new Text(400,145,"CUSTOMER SERVICE");

customer1.setScaleX(1.2);

customer1.setScaleY(1.2);

customer1.setFont(Font.font("Maiandra GD",14));

Text claim1=new Text(590,145,"CLAIMS");

claim1.setScaleX(1.2);

claim1.setScaleY(1.2);

claim1.setFont(Font.font("Maiandra GD",14));

Text payment1=new Text(700,145,"MAKE A PAYMENT");

payment1.setScaleX(1.2);

payment1.setScaleY(1.2);

payment1.setFont(Font.font("Maiandra GD",14));

Text resources1=new Text(880,145,"RESOURCES");

resources1.setScaleX(1.2);

resources1.setScaleY(1.2);

resources1.setFont(Font.font("Maiandra GD",14));

Text about1=new Text(1010,145,"ABOUT US");

about1.setScaleX(1.2);

about1.setScaleY(1.2);

about1.setFont(Font.font("Maiandra GD",14));

Text contact1=new Text(1140,145,"CONTACT");

contact1.setScaleX(1.2);

contact1.setScaleY(1.2);

contact1.setFont(Font.font("Maiandra GD",14));

Text number1=new Text(1010, 80, "620-342-4714");

number1.setStroke(Color.rgb(197,236,79));

number1.setScaleX(2);

number1.setScaleY(2);

Line line1=new Line(0,150,1350,150);

line1.setStroke(Color.GREEN);

line1.setScaleY(2.5);

Rectangle whiteout1=new Rectangle(950, 50, 190, 50);

whiteout1.setFill(Color.WHITE);

Label label1 = new Label("Find Great Protection For Your Home");

label1.setTextFill(Color.rgb(195,195,195));

label1.setTranslateX(100);

label1.setTranslateY(190);

label1.setFont(new Font("Times new roman", 40));

Hyperlink label2 = new Hyperlink();

label2.setText(">Learn More");

label2.setTextFill(Color.rgb(218, 218, 218));

label2.setTranslateX(170);

label2.setTranslateY(330);

label2.setFont(new Font("Times new roman",30));

Rectangle rec1 = new Rectangle(70,410,1228,35);

rec1.setFill(Color.rgb(34, 177, 76));

Label label3 = new Label("WHAT CAN WE HELP YOU COVER?");

label3.setTextFill(Color.WHITE);

label3.setTranslateX(100);

label3.setTranslateY(415);

label3.setFont(new Font("Times new roman",25));

Rectangle rec2 = new Rectangle(70,445,1228,40);

rec2.setFill(Color.rgb(181, 230, 29));

TextField fname1= new TextField();

fname1.setPromptText("First Name");

fname1.setFocusTraversable(false);

fname1.setTranslateX(150);

fname1.setTranslateY(452);

TextField lname1= new TextField();

lname1.setPromptText("Last Name");

lname1.setFocusTraversable(false);

lname1.setTranslateX(350);

lname1.setTranslateY(452);

TextField phone1= new TextField();

phone1.setPromptText("Phone");

phone1.setFocusTraversable(false);

phone1.setTranslateX(550);

phone1.setTranslateY(452);

TextField email1= new TextField();

email1.setPromptText("Email");

email1.setFocusTraversable(false);

email1.setTranslateX(750);

email1.setTranslateY(452);

TextField interested1= new TextField();

interested1.setPromptText("Interested In");

interested1.setFocusTraversable(false);

interested1.setTranslateX(950);

interested1.setTranslateY(452);

Rectangle rec3 = new Rectangle(1150,420,140,60);

rec3.setFill(Color.rgb(222,244,155));

DropShadow ds = new DropShadow();

ds.setOffsetY(3.0f);

ds.setColor(Color.color(0.4f, 0.4f, 0.4f));

Hyperlink label4 = new Hyperlink(">>> GET STARTED!");

label4.setEffect(ds);

label4.setTextFill(Color.GREEN);

label4.setTranslateX(1180);

label4.setTranslateY(415);

label4.setFont(Font.font("Maiandra GD", 15));

//buttons

Hyperlink lbcar1 = new Hyperlink(" Auto Insurance");

lbcar1.setTextFill(Color.GREEN);

lbcar1.setTranslateX(120);

lbcar1.setTranslateY(560);

lbcar1.setFont(Font.font("Rockwell",15));

Hyperlink lbhome1 = new Hyperlink(" Home Insurance");

lbhome1.setTextFill(Color.GREEN);

lbhome1.setTranslateX(335);

lbhome1.setTranslateY(560);

lbhome1.setFont(Font.font("Rockwell",15));

Hyperlink lblife1 = new Hyperlink(" Life Insurance");

lblife1.setTextFill(Color.GREEN);

lblife1.setTranslateX(545);

lblife1.setTranslateY(560);

lblife1.setFont(Font.font("Rockwell",15));

Hyperlink lbbus1 = new Hyperlink(" Business Insurance");

lbbus1.setTextFill(Color.GREEN);

lbbus1.setTranslateX(755);

lbbus1.setTranslateY(560);

lbbus1.setFont(Font.font("Rockwell",15));

Hyperlink lbagr1 = new Hyperlink("Agriculture Insurance");

lbagr1.setTextFill(Color.GREEN);

lbagr1.setTranslateX(958);

lbagr1.setTranslateY(560);

lbagr1.setFont(Font.font("Rockwell",15));

Hyperlink lbvehicle1 = new Hyperlink("Recreational Vehicle");

lbvehicle1.setTextFill(Color.GREEN);

lbvehicle1.setTranslateX(1165);

lbvehicle1.setTranslateY(560);

lbvehicle1.setFont(Font.font("Rockwell",15));

//post

Rectangle box1 = new Rectangle(280,620,350,250);

box1.setFill(Color.WHITE);

box1.setStroke(Color.GREENYELLOW);

box1.setStrokeWidth(5);

Label post1 = new Label("LOOKING TO SAVE MONEY?");

post1.setTranslateX(295);

post1.setTranslateY(635);

post1.setTextFill(Color.GOLD);

post1.setFont(Font.font("Stencil",23));

Label desc1 = new Label("As an independent insurance agency, we"

+ " specialize in providing businesses with the"

+ " best insurance package.");

desc1.setTranslateX(295);

desc1.setTranslateY(680);

desc1.setFont(Font.font("System",15));

Label desc2 = new Label("Our job is to build you a coverage "

+ "portfolio from a wide range of risk "

+ "protection options available.");

desc2.setTranslateX(295);

desc2.setTranslateY(760);

desc2.setFont(Font.font("System",15));

Hyperlink link1 = new Hyperlink("Get A Quote");

link1.setTranslateX(295);

link1.setTranslateY(830);

link1.setFont(Font.font("System",15));

link1.setUnderline(true);

Rectangle box2= new Rectangle(700,620,350,250);

box2.setFill(Color.WHITE);

box2.setStroke(Color.GREENYELLOW);

box2.setStrokeWidth(5);

Label post2 = new Label("WANT FRIENDLY SERVICE?");

post2.setTranslateX(715);

post2.setTranslateY(635);

post2.setTextFill(Color.GOLD);

post2.setFont(Font.font("Stencil",23));

Label desc3 = new Label("You can expect friendly service from our "

+ "staff. Contact us to learn more about the "

+ "right insurance policy for your business.");

desc3.setTranslateX(715);

desc3.setTranslateY(710);

desc3.setFont(Font.font("System",15));

Hyperlink link2 = new Hyperlink("Learn More");

link2.setTranslateX(715);

link2.setTranslateY(830);

link2.setFont(Font.font("System",15));

link2.setUnderline(true);

Rectangle footerBottom1=new Rectangle(0,950,1350,80);

Rectangle btm1=new Rectangle(0,1030,1350,30);

Rectangle insurPics1=new Rectangle(0,880,1350,50);

footerBottom1.setFill(Color.GREEN);

btm1.setFill(Color.DARKGREEN);

insurPics1.setFill(Color.WHITE);

Line line2 =new Line(596,915,596,925);

Line line3 =new Line(704,915,704,925);

line2.setStroke(Color.WHITE);

line3.setStroke(Color.WHITE);

Hyperlink homePage1 = new Hyperlink("Home Page");

homePage1.setTranslateX(400);

homePage1.setTranslateY(930);

homePage1.setTextFill(Color.WHITE);

homePage1.setFont(Font.font("Display",16));

Hyperlink aboutUs1 = new Hyperlink("About Us");

aboutUs1.setTranslateX(520);

aboutUs1.setTranslateY(930);

aboutUs1.setTextFill(Color.WHITE);

aboutUs1.setFont(Font.font("Display",16));

Hyperlink getAQuote1 = new Hyperlink("Get A Quote");

getAQuote1.setTranslateX(610);

getAQuote1.setTranslateY(930);

getAQuote1.setTextFill(Color.WHITE);

getAQuote1.setFont(Font.font("Display",16));

Hyperlink referAFriend1 = new Hyperlink("Refer A Friend");

referAFriend1.setTranslateX(725);

referAFriend1.setTranslateY(930);

referAFriend1.setTextFill(Color.WHITE);

referAFriend1.setFont(Font.font("Display",16));

Hyperlink contactUs1 = new Hyperlink("Contact Us");

contactUs1.setTranslateX(855);

contactUs1.setTranslateY(930);

contactUs1.setTextFill(Color.WHITE);

contactUs1.setFont(Font.font("Display",16));

Hyperlink weather1 = new Hyperlink("Find More About Weather");

weather1.setTranslateX(1050);

weather1.setTranslateY(950);

weather1.setTextFill(Color.WHITE);

weather1.setFont(Font.font("Display",14));

Text addCon1=new Text(470, 965, "2501 W 18th Ave Ste C");

addCon1.setStroke(Color.WHITE);

addCon1.setScaleX(1);

addCon1.setScaleY(1);

Text addCity1=new Text(595, 965, "Emporia, KS 66801");

addCity1.setStroke(Color.WHITE);

addCity1.setScaleX(1);

addCity1.setScaleY(1);

Text addPh1=new Text(710, 965, "Phone: 620-342-4714");

addPh1.setStroke(Color.WHITE);

addPh1.setScaleX(1);

addPh1.setScaleY(1);

//contains all text, images, shapes to display

//colors for border, body, trim

header1.setFill(Color.WHITE);

footer1.setFill(Color.GREEN);

// scroller.setFill(Color.WHITE);

//contains all text, images, shapes to display

Group root1 = new Group(header1, footer1, home1,quote1,customer1,claim1,

payment1, resources1, about1, contact1,line3,line1,line2,whiteout1,number1, mainMenu);

// root1.getChildren().addAll(s);

//((JFrame) root1.getChildren()).setJMenuBar(menuBar);

root1.getChildren().addAll(label1,label2,rec1,label3);

root1.getChildren().addAll(rec2,fname1,lname1,phone1,email1,interested1,rec3,label4);

root1.getChildren().addAll(lbcar1,lbhome1,lblife1,lbbus1,lbagr1,lbvehicle1);

root1.getChildren().addAll(box1,box2,link1,link2);

root1.getChildren().addAll(post1,post2,desc1,desc2,desc3);

root1.getChildren().addAll(footerBottom1,btm1,insurPics1);

root1.getChildren().addAll(weather1, homePage1,aboutUs1,getAQuote1,referAFriend1,contactUs1,addCon1,addCity1,addPh1);

ScrollPane scrollPane1 = new ScrollPane();

scrollPane1.setContent(root1);

scrollPane1.setPannable(true);

//contains the group, the window size, and window color

Scene scene1 = new Scene(scrollPane1, 1350, 1000);

primaryStage.setTitle("Home");

primaryStage.setScene(scene1);

primaryStage.show();

}

//main launches the program using launch function

public static void main(String[] args) {

launch(args);

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions

Question

What are the three major steps in the writing process? [LO-1]

Answered: 1 week ago