简体   繁体   中英

show images in textarea

I have to implement gtalk like chat application using UDP in java. i have written server and client programs to send/receive text,smileys(compulsory).

the problem is that image can't be displayed in text area.i want to display both the incoming text and smiley in a control.Text area won't work. please suggest some other control...

You can use javax.swing.JTextPane

Check TextSamplerDemo

You can find plenty of examples here:

http://www.java2s.com/Code/Java/Swing-JFC/TextPaneSample.htm

Chat window using JTextPane no images though:

Java JTextPane JScrollPane Display Issue

尝试使用contentEditable属性的div

Could you use the unicode character for a "White Smiling Face" and a font that supports this character? Then you don't need to worry about images at all.

The unicode for white smiling face is \☺

If you browser is using a font that supports it, you'll see it here: ☺

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM