Question: Examine the code and figure out how to add another button to the GUI. Have this button double the number that the user enters. You
Examine the code and figure out how to add another button to the GUI. Have this button double the number that the user enters. You will have to modify code in multiple files to accomplish this.
Add a fourth button, name it, and wire It to accomplish that function.
Paste a screen shot of your four-action GUI with the correct result from one of your buttons.
**********Java File**********************************************************************
/* Simple Math Operations Using Buttons
*/
import java.net.URL;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.layout.VBox;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class SimpleMathPractice extends Application
{
@Override
public void start( Stage stage ) // throws Exception
{
try
{
URL url =
getClass( ).getResource( "fxml_simple_math.fxml" );
VBox root = FXMLLoader.load( url );
Scene scene = new Scene( root, 300, 275 );
scene.getStylesheets( ).add( "simple_math.css" );
stage.setTitle( "Simple Math" );
stage.setScene( scene );
stage.show( );
}
catch ( Exception e )
{
e.printStackTrace( );
}
}
public static void main( String [] args )
{
launch( args );
}
}
**********************Fxml File*************************************
"1.0" encoding="UTF-8"?>
xmlns:fx="http://javafx.com/fxml"
alignment="center" spacing="10" >
onAction="#calculate" />
onAction="#calculate" />
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
