MySQL-Blob für Netbeans JLabel
Ich habe ein Feld vom Typ "Blob" in MySQL. Ich möchte die Daten in dieses Feld einfügenJLabel
als Icon. Zum Beispiel dasJLabel
wird das Profilbild des Benutzers in meinem Formular sein.
Ich habe diese Codes benutzt, aber nichts passiert und ich möchte auchfix to width
oder korrigiere eine beliebige Bildgröße in meinem Jlabel
DefaultTableModel pic = MyDB.DataTable("SELECT `Picture` FROM `photo` WHERE `Employee ID` = 'EQ0103'");
if (pic.getRowCount() > 0){
Blob blob = pic.getBlob(1);
byte[] image1 = blob.getBytes(1, ALLBITS);
ImageIcon image = new ImageIcon(image1);
picture.setIcon(image);
getContentPane().add(picture);
setVisible(true);
}
picture
ist der Name meines Labels