Text Area, use HTML format

1,657 views
Skip to first unread message

Serega....@gmail.com

unread,
Sep 17, 2007, 6:33:43 AM9/17/07
to Google Web Toolkit
Hi, the problem is:
I use TextArea.
I want to show there bold text.
Is there any possibility do do this?

For example, if I do

textArea.setText("the first line" + "\n" + "the second line");

I can see two lines.

And I want some strings to become bold.


textArea.setText("<b>" + "BOLD STRING" + "</b>");

doesnt' work. I get:

<b>BOLD STRING</b>

Can you suggest me something?

RichText is useless...I user TextArea just as static filed for
depicting sitring of text. No user format is needed.

Romain

unread,
Sep 17, 2007, 8:05:44 AM9/17/07
to Google Web Toolkit
Hi,
Your question is more an HTML question than a GWT one.
Actually, by design, you can't have "text formatting" in HTML
TextArea.
GWT implementation of TextArea is just call to DOM for a creation of
an HTML TextArea Object. Thus, GWT object has the same limitations as
HTML object

Your only solution is to use a RichText Control to have a smart
display or to change your mind and forget about your bold text. Sorry
For you.

Regards.

Romain
http://dismoiou.fr
http://tellmewhere.com


On 17 sep, 12:33, "Serega.Shey...@gmail.com"

Josh Hinman

unread,
Sep 17, 2007, 2:22:58 PM9/17/07
to Google Web Toolkit
Why are you using a TextArea as a static field? Why not use an HTML
widget?

http://code.google.com/webtoolkit/documentation/com.google.gwt.user.client.ui.HTML.html

Josh

On Sep 17, 3:33 am, "Serega.Shey...@gmail.com"

Serega....@gmail.com

unread,
Sep 18, 2007, 7:52:14 AM9/18/07
to Google Web Toolkit
That is great, but I am making chat
I need some kind of window, where all messages will be shown....
HTML instance class it's great, but it's not a window...It's just
extension of the Label

On 17 сент, 22:22, Josh Hinman <josh.hin...@gmail.com> wrote:
> Why are you using a TextArea as a static field? Why not use an HTML
> widget?
>

> http://code.google.com/webtoolkit/documentation/com.google.gwt.user.c...

Reinier Zwitserloot

unread,
Sep 18, 2007, 9:53:05 AM9/18/07
to Google Web Toolkit
You can style a label, or an HTML, to look pretty much exactly like a
non-editable textarea. give it a border, another font perhaps,
different background colour if it seems useful, and off you go.

On Sep 18, 1:52 pm, "Serega.Shey...@gmail.com"

Josh Hinman

unread,
Sep 18, 2007, 1:47:57 PM9/18/07
to Google Web Toolkit
As a matter of fact, I'm working on a project right now where I had to
style an HTML widget to look like a non-editable text area. Here is
the style I used:

.gwt-HTML {
width: 198px;
height: 98px;
border: 1px solid black;
overflow: auto;
}

That will give it a fixed size, thin black border and scroll bars,
just like a text area. Have fun.

Josh

Serega....@gmail.com

unread,
Sep 19, 2007, 12:13:17 PM9/19/07
to Google Web Toolkit
Thank you, I'll try!
Seems like it's great solution!

> > > > > depicting sitring of text. No user format is needed.- Hide quoted text -
>
> - Show quoted text -

Reply all
Reply to author
Forward
0 new messages