I have already searched on stackoverflow my same question and I found someone with the same question but I could not fix my problem with the answer from that question. Anyways I am new to GWT and when I tried to make a RichTextArea, I thought it would make something that would look like the sample in http://www.gwtproject.org/doc/latest/RefWidgetGallery.html (scroll down till you see RichTextArea) but instead there is just a plain text area without a tool bar. How come there is no tool bar in mine? Can someone help me and can you show me how to change my code so that it looks like the sample. Also I figured that it might have something to do with the Formatter or the getFormatter method if it does can you show me how to do that. here is my code:
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.RichTextArea;
import com.google.gwt.user.client.ui.RichTextArea.Formatter;
import com.google.gwt.user.client.ui.RootPanel;
public class Widgets implements EntryPoint
{
private Button btn;
private Button cbtn;
private RichTextArea textArea;
public void onModuleLoad()
{
btn = new Button("Submit");
cbtn = new Button("Clear");
textArea = new RichTextArea();
Formatter format = textArea.getFormatter();
cbtn.addClickHandler(new ClickHandler(){
public void onClick(ClickEvent event) {
textArea.setText("");
}
});
RootPanel.get().add(textArea);
RootPanel.get().add(btn);
RootPanel.get().add(cbtn);
}
}
Take a look at the GWT Showcase, Here. In the source code you can see that there is a
RichTextToolbar
, which you need to instantiate and associate with theRichTextArea
.