base64 image into JTextPane
Posted
by Nicolas
on Stack Overflow
See other posts from Stack Overflow
or by Nicolas
Published on 2010-04-29T08:30:42Z
Indexed on
2010/04/29
9:37 UTC
Read the original article
Hit count: 554
Is it possible to display a base64 encrypted image into a JTextPane ?
Here my code
JTextPane jTextPane = new JTextPane();
javax.swing.text.html.HTMLEditorKit eKit = new javax.swing.text.html.HTMLEditorKit();
jTextPane.setEditorKit(eKit);
jTextPane.setContentType("text/html");
// my base64 image, used then in the img tag in the html...
String img64="data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAwAAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFzByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSpa/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJlZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uisF81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PHhhx4dbgYKAAA7";
jTextPane.setText(html);
© Stack Overflow or respective owner