Miletone

Rp0 / Rp1.000.000

Sunday, September 29, 2019

[JAVA] How to Retrieve Image from JTable and/or Database.

Action Performed :
try{
        int Click = jTable1.getSelectedRow();
Blob filenameBlob = (Blob) (jTable1.getValueAt(Click, 1));
        byte[] content = filenameBlob.getBytes(1L,(int)filenameBlob.length());
        if(jTable1.getValueAt(Click, 1) !=null){
            ImageIcon image = new ImageIcon(content);
        Image image1 = image.getImage().getScaledInstance(photo.getWidth(), photo.getHeight(), Image.SCALE_SMOOTH);
        ImageIcon image2 = new ImageIcon(image1);
        photo.setIcon(image2);
        }
     
        } catch (Exception e){
         
        }

No comments: