So, i've set up a GUI that has a text field and a button. I have some images in my file, as shown below.
I wanna be able to input in the textField "A0" and it show (anywhere at this point) the image on the GUI. I'm not sure how to approch this, any help or example would be appreciated.
EDIT:
private void getImage(){
char key;
Image img = new Image("gui/assets/" + textField.getText() + ".png", 100, 100, false, false);
ImageView image = new ImageView();
image.setImage(img);
image.setX(40);
image.setY(480);
pane.getChildren().add(image);
}
So this is what i've done (pane is just a group). Also, this is the primaryStage;
@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);
root.getChildren().add(pane);
makeControls();
primaryStage.setScene(scene);
primaryStage.show();
}
So i added the group that adds the image into primaryStage, however when i input an image name e.g "A0", nothing comes up. What am i missing?