1package com.jenkov.javafx.controls;
2
3import javafx.application.Application;
4import javafx.scene.Scene;
5import javafx.scene.control.Button;
6import javafx.scene.image.Image;
7import javafx.scene.image.ImageView;
8import javafx.scene.layout.HBox;
9import javafx.stage.Stage;
10
11import java.io.FileInputStream;
12
13public class ImageViewExperiments extends Application {
14
15
16 @Override
17 public void start(Stage primaryStage) throws Exception {
18 primaryStage.setTitle("ImageView Experiment 1");
19
20 FileInputStream input = new FileInputStream("resources/images/iconmonstr-home-6-48.png");
21 Image image = new Image(input);
22 ImageView imageView = new ImageView(image);
23
24 HBox hbox = new HBox(imageView);
25
26 Scene scene = new Scene(hbox, 200, 100);
27 primaryStage.setScene(scene);
28 primaryStage.show();
29
30 }
31
32 public static void main(String[] args) {
33 Application.launch(args);
34 }
35
36}
37
38
1Rectangle2D screenBounds = currentScreen.getBounds();
2double screenCenterX = screenBounds.getMinX() + screenBounds.getWidth()/2 ;
3double screenCenterY = screenBounds.getMinY() + screenBounds.getHeight()/2 ;
4
1Rectangle2D screenBounds = currentScreen.getBounds();
2double screenCenterX = screenBounds.getMinX() + screenBounds.getWidth()/2 ;
3double screenCenterY = screenBounds.getMinY() + screenBounds.getHeight()/2 ;
4