I'm not sure about a textarea. But you can do this using a ScrollPanel.
You can add a FlowPanel to your ScrollPanel. All your text messages can be Label Widgets that you Add to your Flow Panel. After adding the Label Widget you can call: scrollPanel.scrollToBottom(); Or... scrollPanel.ensureVisible(someWidget) I am doing something similar with a scrollable form, if there is a data entry error, I can scroll to the field in error and display it to the user. Thanks, Mike. That will force the On Aug 20, 3:53 am, Aximilli302 <aximilli...@gmail.com> wrote: > Hello all! > > I am trying to make a text area scroll. I am trying to simulate a type > of chat room envirement, where the user types into a text box, presses > enter, then the text apears into a read only text area, with the text > aera auto scrolling to the bottom. Is there a way to make the read > only text area scroll? > > Here is some of my code. > > private TextBox text = new TextBox(); > private Button enter = new Button("Enter"); > private TextArea textArea = new TextArea(); > > textArea.setReadOnly(true); > textArea.setVisibleLines(5); > > text.addKeyPressHandler(new KeyPressHandler){ > public void onKeyPress(KeyPressEvent event) { > if (event.getCharCode() == KeyCodes.KEY_ENTER) { > enterClicked(); > } > } > }); > > private void enterClicked(){ > String previousText = textArea.getText(); > String newText = previousText + "\n" + text.getText(); > textArea.setText(newText); > text.setText(""); > text.setFocus(true); > } > > Any help would be awesome. Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~----------~----~----~----~------~----~------~--~---