Issue showing an Image using the imageview from JavaFx

时间:2015-09-02 16:12:49

标签: java mysql javafx imageview javafx-8

I got a problem showing an image using the imageview from javafx ...

First is I load the stored image(Blob) from mySql then pass it to my Model class as ByteArrayInputStream.

At First when you click the 'Info' Button at the first time it will Open the 'INFO' class and showing you the image, but when you close it and reOpen it then the image suddenly disappear or not showing anything.

Opening it at First Time

enter image description here

中发送链接

你可以看到图像,但是......

如果您再次重新开课

enter image description here

它不会显示任何内容或图像无法加载

以下是代码:

public void setPerson(Person person){

    this.person = person;
    ByteArrayInputStream in = person.getImage();
    if(in != null){
        iv_image.setImage(new Image(person.getImage()));    
    }else{
        iv_image.setImage(null);
    }

    lbl_id.setText("" + person.getId());
    lbl_date.setText(person.getDate());
    lbl_fname.setText(person.getFname());
}

0 个答案:

没有答案