为什么按钮上的javafx图像视图未按预期设置

时间:2016-05-01 12:33:53

标签: button javafx imageview gallery

我使用按钮在javafx中制作随机图库。我正在将imageView设置为按钮,因为我需要点击图像。问题是imageView未按预期设置按钮。按钮的高度和宽度均为110.

This is the Before Image note Buttons distance

This is after Image why distance is changed

以下是用于为按钮设置imageView的代码。

for(int i=0; i<35; i++){
    Button button = list.get(i);
    ImageView imageview =new ImageView(imageList.get(i));
    imageview.setPreserveRatio(true);
    imageview.setFitHeight(110);
    imageview.setFitWidth(110);
    button.setGraphic(imageview);
}

1 个答案:

答案 0 :(得分:1)

您需要将booknode* tempNext; booknode* tempPrevious; tempNext = head->next; tempPrevious = head->previous; delete head; tempNext->previous = tempPrevious; temoPrevious->next = tempNext; head = tempNext; 的{​​{3}}更改为空:

Button