import java.io.FileInputStream; import java.io.FileNotFoundException; import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.text.Font; public class App extends Application { public static void main(String[] args) { launch(args); } private ImageView getImage() { ImageView imageView = null; try { imageView = tryGetImage(); } catch (Exception e) { System.err.println("Hiba! A fájl nem található"); } return imageView; } private ImageView tryGetImage() throws FileNotFoundException{ String iconPath = "resources/images/kep02.png"; FileInputStream input = new FileInputStream(iconPath); Image image = new Image(input); ImageView imageView = new ImageView(image); return imageView; } @Override public void start(Stage stage) { Label label = new Label("Helló", getImage()); label.setFont(new Font("Arial", 24)); Scene scene = new Scene(label, 300, 250); stage.setScene(scene); stage.setTitle("Valami"); stage.show(); } }