Create ImageView in JavaFX
________________________________________________
import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.HBox; import javafx.stage.Stage; public class JavaFXImageView extends Application{ @Override public void start(Stage stage) { HBox pane = new HBox(); Image img = new Image("\\Your image location");
ImageView iV = new ImageView(); iV.setImage(img); iV.setFitHeight(200); iV.setFitWidth(200); pane.getChildren().add(iV); Scene scene = new Scene(pane, 250, 250); stage.setTitle("JavaFX ImageView"); stage.setScene(scene); stage.show(); } public static void main(String[] args) { Application.launch(args); } }
_____________________________________________
Dark Hers
YouTube
https://instagram.com/darkhers
https://www.facebook.com/darkhers
TikTok
https://www.tiktok.com/@darkhers
https://www.pinterest.co.uk/darkhers
Comments
Post a Comment