Question: Hello, I am supposed to make a program where I make GUI buttons on javafx in eclipse that subtract multiply, divide clear and exit. I

Hello, I am supposed to make a program where I make GUI buttons on javafx in eclipse that subtract multiply, divide clear and exit. I have never done this before and am lost. Can someone do multiply for me as an example? He did add but i am still lost. and not sure how to write my code.

 { try { Label num1L = new Label("Number 1 : "); TextField num1TF = new TextField(); Label num2L = new Label("Number 2 : "); TextField num2TF = new TextField(); Label answerL = new Label("Answer : "); TextField answerTF = new TextField(); Button add = new Button("ADD"); add.setOnAction(new EventHandler() { @Override public void handle(ActionEvent e) { int num1= Integer.parseInt(num1TF.getText()); int num2= Integer.parseInt(num2TF.getText()); total = num1 + num2; String str = Integer.toString(total); answerTF.setText(str); } }); GridPane root = new GridPane(); root.add(num1L, 0, 0); root.add(num1TF, 1, 0); root.add(num2L, 0, 1); root.add(num2TF, 1, 1); root.add(answerL, 0, 2); root.add(answerTF, 1, 2); root.add(add, 0, 6); Scene scene = new Scene(root,500,500); primaryStage.setScene(scene); primaryStage.show(); } catch(Exception e) { e.printStackTrace(); } } 

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!