ciao,
leggendo altri post ho caricato da mysql un'immagine ma ora vorrei disegnarla in un jpanel, come fare?
il fatto è che il codice è
codice:
try{
PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM IMMAGINE");
ResultSet rs = pstmt.executeQuery();
// estrazione
while (rs.next()) {
OutputStream fos = new FileOutputStream(new File("./xxx.jpg"));
InputStream fin = rs.getBinaryStream("lastra");
byte[] b = new byte[fin.available()];
fin.read(b);
Graphics g = jPanel.getGraphics();
g.drawBytes(b, 0, b.length, 10,20);
fos.write(b);
fos.flush();
fos.close();
}
}catch(Exception d){d.printStackTrace();}
}
la scrittura su file di bytes[] come immagine avviene con successo... ma come fare altrettanto su un jpanel?