tags:

views:

102

answers:

3

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...

A: 

Try a div with a contentEditable attribute.

Douglas
+2  A: 

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:

http://stackoverflow.com/questions/2741598/java-jtextpane-jscrollpane-display-issue

YoK
A: 

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 \u263A

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

Steve McLeod