I'm trying to use ImageView to add a picture in my JavaFX application. So far I have the following implementation that is throwing a InvocationTargetException. Is there something wrong with my implementation?
public class TowerDefense extends Application {
@Override public void start(Stage stage) {
// load the image
Image image = new Image("MapCropped.png");
//displays ImageView image
ImageView one = new ImageView();
one.setImage(image);
HBox box = new HBox();
box.getChildren().add(one);
Scene scene = new Scene(box);
stage.setTitle("Balloon Tower Defense");
stage.setWidth(415);
stage.setHeight(200);
stage.setScene(scene);
stage.sizeToScene();
stage.show();
}
}
Aucun commentaire:
Enregistrer un commentaire