Java examples for JavaFX:Image
get Icon of JavaFX ImageView
import javafx.scene.image.Image; import javafx.scene.image.ImageView; public class Main{ public static ImageView getIcon(String path, int size) { Image icon = new Image(FXUtils.class.getResourceAsStream(path)); ImageView imageView = new ImageView(icon); imageView.setFitWidth(size);/*from ww w .j a v a 2s. c o m*/ imageView.setFitHeight(size); return imageView; } }