If anyone has any ideas on this, it would be greatly appreciated.

On Nov 6, 8:23 am, chris <[email protected]> wrote:
> I was wondering if anyone knew how to wrap text like several chat
> applications do. I have a ChatArea private class that I am trying to
> add to a widget. It works, however if a message to add to the chat
> text is 1000 characters with no new lines, the ScrollPanel does not
> wrap the text and adds a very long horizontal scroll.
>
> private class ChatPart extends ScrollPanel {
>
>                 final FlexTable flexTable = new FlexTable();
>
>                 ChatPart() {
>                         super();
>                         FlexCellFormatter cellFormatter = 
> flexTable.getFlexCellFormatter();
>                         cellFormatter.setColSpan(0,0,2);
>                         flexTable.addStyleName("chat-FlexTable");
>                         flexTable.setWidth("100%");
>                         this.add(flexTable);
>                         this.setWidth("100%");
>                         this.setHeight("300");
>                 }
>
>                 /**
>                  * Add a message
>                  */
>                 void addMessage(String user, String message) {
>                         int numRows = flexTable.getRowCount();
>                         
> flexTable.getFlexCellFormatter().setVerticalAlignment(numRows, 0,
> HasVerticalAlignment.ALIGN_TOP);
>                         
> flexTable.getFlexCellFormatter().setVerticalAlignment(numRows, 1,
> HasVerticalAlignment.ALIGN_TOP);
>                         flexTable.getFlexCellFormatter().setWordWrap(numRows, 
> 1, true);
>
>                         flexTable.setWidget(numRows, 0, 
> ChatApplication.images.greenIcon
> ().createImage());
>                         flexTable.setWidget(numRows, 1, new HTML("<b>" + user 
> + ":</b>
> "+message));
>                         flexTable.getFlexCellFormatter().setRowSpan(0, 1, 
> numRows+1);
>                         this.scrollToBottom();
>                 }
>         }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to