add a radio button in RichTextArea
There is a RichTextArea
Code :
private final RichTextArea rta = new RichTextArea();
and I'd like when I press an asterisk to add a radio button in this RichTextArea.
I wrote
Code :
if(event.getCharCode()=='*')
{
RadioButton radio0 = new RadioButton("group0", "");
HorizontalPanel hp = new HorizontalPanel();
hp.add(radio0);
RootPanel.get().add(hp);
}
it creates a radio button out of the RTA but I can't add it in the RTA, specifically where the cursor is and without the asterisk.
Any idea how to do that? Thank you very much for any help in advance.
Re: add a radio button in RichTextArea
first of all.. why do u want to create a rich text area? Cant you simply add the radio button to a new panel..
also.. try creating and adding the radio button to the component u want it on.. and set it to visible when the asterisk is pressed. and use the mouseListener to get the position of the cursor to be able to position the item.
Not to sure if this reply will help. not near eclipse at the moment so i cannot really test code.
good luck
Re: add a radio button in RichTextArea
Thank you for your reply.
I choose the RichTextArea to use it's functions as toggleBold(), toggleItalics(), insertUnorderedList() etc.
I tried to add the rta and the radioButtons in a horizontalPanel and then this one to the RootPanel but it shows the buttons in the left side of the rta
because it stores the rta in the first column and the radiobutton in the second column of the horizontal panel.