Question: Add code in ??? import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.HBox; import javafx.stage.Stage; public
Add code in ??? import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.HBox; import javafx.stage.Stage;
public class Viewer extends Application { /* board layout */ private static final int SQUARE_SIZE = 60; private static final int PIECE_IMAGE_SIZE = (int) ((3*SQUARE_SIZE)*1.33); private static final int VIEWER_WIDTH = 750; private static final int VIEWER_HEIGHT = 500; private static final String URI_BASE = "assets/"; private final Group root = new Group(); private final Group controls = new Group(); TextField textField; /** * Draw a placement in the window, removing any previously drawn one * * @param placement A valid placement string */ void makePlacement(String placement) { ??????? } /** * Create a basic text field for input and a refresh button. */ private void makeControls() { Label label1 = new Label("Placement:"); textField = new TextField (); textField.setPrefWidth(300); Button button = new Button("Refresh"); button.setOnAction(new EventHandler() { @Override public void handle(ActionEvent e) { makePlacement(textField.getText()); textField.clear(); } }); HBox hb = new HBox(); hb.getChildren().addAll(label1, textField, button); hb.setSpacing(10); hb.setLayoutX(130); hb.setLayoutY(VIEWER_HEIGHT - 50); controls.getChildren().add(hb); } @Override public void start(Stage primaryStage) throws Exception { primaryStage.setTitle("StepsGame Viewer"); Scene scene = new Scene(root, VIEWER_WIDTH, VIEWER_HEIGHT); root.getChildren().add(controls); makeControls(); primaryStage.setScene(scene); primaryStage.show(); } } This is all the code!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
