//Button - btnSend
    //RichTextArea richText 
    //VerticalPanel pnlMessage                           

                              btnSend.addClickHandler(new ClickHandler(){
                                                @Override
                                                public void 
onClick(ClickEvent event) {
                                                    UserInfo myUser = new 
UserInfo();
                                                    String tempText = 
 myUser.getLoginName();
                                                    HTML getHTML = new 
HTML("<b>"+tempText+"</b> : "+richText.getHTML());
                                                    pnlMessage.add(getHTML);
                                                    richText.setText("");
                                                 }
                                   });
                                
                                richText.addKeyDownHandler(new 
KeyDownHandler() {
                        @Override
                        public void onKeyDown(KeyDownEvent event) {
                        if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER){ 
                                                     UserInfo myUser = new 
UserInfo();
                                                                     String 
tempText =  myUser.getLoginName();
                                                                        
  HTML getHTML = new HTML("<b>"+tempText+"</b> : "+richText.getHTML());
                                                                        
 pnlMessage.add(getHTML);
                                                                        
 richText.setText("");
                                                                            
                                      
                        }
                        }
                        });

Though I am adding the content from RichTextArea to a VerticalPanel. I get 
some additional spaces adding in the RichTextArea only with the Enter Key 
Handling.

<https://lh3.googleusercontent.com/-3wk-dE6egD0/VegfFE1OkHI/AAAAAAAABBY/C9cZDtyo-z0/s1600/show1.JPG>

<image:  Button Click Event Handling>

<https://lh3.googleusercontent.com/-Y30nY8mrId0/VegfOuEdTYI/AAAAAAAABBg/edasCh7ukvQ/s1600/show2.JPG>

<image: Enter Key Event Handling>




-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to