Question
hi, Can I have the Java FX code to implement the function below: I am looking to complete where it says // FIXME Task
hi, Can I have the Java FX code to implement the function below:
I am looking to complete where it says " // FIXME Task 4: implement the simple placement viewer "
These are the origins of the 36 cards I want to show:
4 | Y | S | M | G | A |
5 | Z | T | N | H | B |
6 | 0 | U | O | I | C |
7 | 1 | V | P | J | D |
8 | 2 | W | Q | K | E |
9 | 3 | X | R | L | F |
I need to:
1.Display images of cards in the window (anywhere)
2.Display images of cards so that their origin is in the correct place.
3.Display images so that their cards is in the correct place and their orientation is correct.
4.Break placement strings into card placements.
5. Fix the makePlacement() method of the Viewer class so that it works correctly.
I need to create a grid that displays 36 cards, but I don't know how to do this.
Sorry I have no experience and I'm new to java.
Could you please fix task 4 and comment
Thankyou very much
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;
/** * A very simple viewer for card layouts in the Warring States game. *
* NOTE: This class is separate from your main game class. This * class does not play a game, it just illustrates various card placements. */ public class Viewer extends Application {
private static final int VIEWER_WIDTH = 933; private static final int VIEWER_HEIGHT = 700;
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) { // FIXME Task 4: implement the simple placement viewer }
/** * 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 start(Stage primaryStage) throws Exception { primaryStage.setTitle("Warring States Viewer"); Scene scene = new Scene(root, VIEWER_WIDTH, VIEWER_HEIGHT);
root.getChildren().add(controls);
makeControls();
primaryStage.setScene(scene); primaryStage.show(); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started