if( rs.getBlob("DclImage") == null ){
jLabel_Image.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/datacraft.jpg")));
}else{
java.sql.Blob imageBlob = rs.getBlob("DclImage");
byte[] imageBytes = imageBlob.getBytes(1, (int) imageBlob.length());
// for scalling image code
ImageIcon tinyPicture= new ImageIcon(imageBytes);
Image image= tinyPicture.getImage();
image = image.getScaledInstance(105, -1, image.SCALE_SMOOTH);
tinyPicture.setImage(image);
jLabel_Image.setIcon(tinyPicture);
}
jLabel_Image.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/datacraft.jpg")));
}else{
java.sql.Blob imageBlob = rs.getBlob("DclImage");
byte[] imageBytes = imageBlob.getBytes(1, (int) imageBlob.length());
// for scalling image code
ImageIcon tinyPicture= new ImageIcon(imageBytes);
Image image= tinyPicture.getImage();
image = image.getScaledInstance(105, -1, image.SCALE_SMOOTH);
tinyPicture.setImage(image);
jLabel_Image.setIcon(tinyPicture);
}
No comments:
Post a Comment