private void showAddNewComment() { newCommentLayout.clear(); final TextArea comment = new TextArea(); comment.setWidth("100%"); newCommentLayout.add(comment); Button ok = new Button(constants.OK()); Button cancel = new Button(constants.Cancel()); ok.addClickHandler( new ClickHandler() { public void onClick(ClickEvent sender) { sendNewComment(comment.getText()); } }); cancel.addClickHandler( new ClickHandler() { public void onClick(ClickEvent sender) { showNewCommentButton(); } }); HorizontalPanel hp = new HorizontalPanel(); hp.add(ok); hp.add(cancel); newCommentLayout.add(hp); comment.setFocus(true); }