Example usage for javafx.scene.control Button setGraphic

List of usage examples for javafx.scene.control Button setGraphic

Introduction

In this page you can find the example usage for javafx.scene.control Button setGraphic.

Prototype

public final void setGraphic(Node value) 

Source Link

Usage

From source file:vkmanager.controller.PhotosDetailedController.java

public void showPhotosFromAlbum(VKPhotoAlbum album, int userId) {
    this.album = album;
    idForDownload = album.getId();//from w  ww.ja va  2s  .  co  m
    albumDescription.setText(album.getDescription());
    photos = vkapi.getPhotosFromAlbum(idForDownload, userId);

    int i = 0;
    int j = 0;
    gridPaneDetailed.addRow(0);
    for (VKPhoto photo : photos) {
        Image photoThumbLink = new Image(photo.getLink_s());
        ImageView photoThumb = new ImageView(photoThumbLink);

        photoThumb.setFitHeight(160);
        photoThumb.setFitWidth(240);

        photoThumb.setPreserveRatio(true);
        photoThumb.setSmooth(true);
        photoThumb.setCache(true);

        Button photoButt = new Button();
        photoButt.setGraphic(photoThumb);
        photoButt.setStyle("-fx-background-color: white;");
        photoButt.setMinSize(240, 160);
        photoButt.setAlignment(Pos.CENTER);

        BorderPane bp = new BorderPane(null, photoButt, null, null, null);
        gridPaneDetailed.add(bp, j, i);

        j++;
        if (j == 3) {
            i++;
            j = 0;
            gridPaneDetailed.addRow(i);
        }
    }
}