>I want to display small pictures in a text window, its actually emoticons
>in a messenger I want to implement. How should I do this in Java. Ideally
>I would like to support animated pictures, but any method to display any
>format would be welcome.
see JTextPane.insertIcon(Icon g)

Signature
Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities
Allan Bruce - 13 Jan 2006 21:20 GMT
> >I want to display small pictures in a text window, its actually emoticons
> >in a messenger I want to implement. How should I do this in Java.
> >Ideally I would like to support animated pictures, but any method to
> >display any format would be welcome.
>
> see JTextPane.insertIcon(Icon g)
Thanks,
Can I also change the colour of fonts with a JTextArea? I had a look but
couldnt see how. Is there a way to have changable colour fonts AND be able
to add the pictures?
Many Thanks
Allan
Andrey Kuznetsov - 13 Jan 2006 23:09 GMT
> Can I also change the colour of fonts with a JTextArea? I had a look but
> couldnt see how. Is there a way to have changable colour fonts AND be
> able to add the pictures?
with JTextPane you can many things.
some important keywords: setCharacterAttributes, setParagraphAttributes,
AttributeSet

Signature
Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities
Allan Bruce - 14 Jan 2006 03:07 GMT
>> Can I also change the colour of fonts with a JTextArea? I had a look but
>> couldnt see how. Is there a way to have changable colour fonts AND be
[quoted text clipped - 3 lines]
> some important keywords: setCharacterAttributes, setParagraphAttributes,
> AttributeSet
Aha, JTextPane! I was using a JTextAre. Thanks, its working now.
Allan
Allan Bruce - 14 Jan 2006 03:43 GMT
>> Can I also change the colour of fonts with a JTextArea? I had a look but
>> couldnt see how. Is there a way to have changable colour fonts AND be
[quoted text clipped - 3 lines]
> some important keywords: setCharacterAttributes, setParagraphAttributes,
> AttributeSet
Actually, there is one last thing - I might be pushing it here! What if I
wanted to add a background image instead of the plain coloured background.
Do you know if this is possible?
Thanks
Allan
Andrey Kuznetsov - 14 Jan 2006 11:08 GMT
> Actually, there is one last thing - I might be pushing it here! What if I
> wanted to add a background image instead of the plain coloured background.
> Do you know if this is possible?
probably you could create your own BTextpane
and override paintComponent as follow:
public void paintComponent(Graphics g) {
paintBackgroundImage();
super.paint(g);
}

Signature
Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities
Roedy Green - 14 Jan 2006 03:53 GMT
>Can I also change the colour of fonts with a JTextArea?
Yes, is the usual way. see http://mindprod.com/jgloss/jtextarea.html
but everything must be the same. If you want variety, you need a
JTextPane or JEditorPane.
See http://mindprod.com/jgloss/jeditorpane.html
http://mindprod.com/jgloss/jtextpane.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Allan Bruce - 16 Jan 2006 21:36 GMT
> >I want to display small pictures in a text window, its actually emoticons
> >in a messenger I want to implement. How should I do this in Java.
> >Ideally I would like to support animated pictures, but any method to
> >display any format would be welcome.
>
> see JTextPane.insertIcon(Icon g)
I have this implemented now, however some of the animated gifs come out
slightly corrupted, in that a few of the frames are wrong, or they only show
part of the file - is there anything I can do or should be doing to avoid
this?
Thanks
Allan