image « MySQL « JPA Q&A

1. Display image from database (MySQL via hibernate) in JEditorPane?

i have to display image stored in my database, or e.g. created in program memory, in JEditorPane. Is there any way to do it? Thanks for reply. I forgot tell that my ...

4. save image in mysql using java

public class Person { ... private byte[] photo; ... public Icon loadPhoto() { if (photo != null) return new ImageIcon(photo); else return new ImageIcon(Person.class.getResource("noface.png")); }

5. saving image file to mysql

FileInputStream in = new FileInputStream(file); ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] b = new byte[1024]; ...