Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: add a radio button in RichTextArea

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default add a radio button in RichTextArea

    There is a RichTextArea

    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

     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.


  2. #2
    Member
    Join Date
    Mar 2011
    Posts
    198
    My Mood
    Daring
    Thanks
    7
    Thanked 4 Times in 4 Posts

    Default 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

  3. #3
    Junior Member
    Join Date
    Nov 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.

Similar Threads

  1. Radio button .. display empty screen ?? plz Help
    By smasm in forum AWT / Java Swing
    Replies: 4
    Last Post: April 7th, 2012, 08:21 PM
  2. [SOLVED] I am unable to read radio button actions in JSP
    By abhiM in forum What's Wrong With My Code?
    Replies: 5
    Last Post: August 17th, 2011, 02:41 AM
  3. need help Coding RADIO BUTTON for REMEMBER ME
    By timosoft in forum Java Theory & Questions
    Replies: 3
    Last Post: February 4th, 2011, 05:19 PM
  4. Adding Radio Button Values
    By bazazu in forum What's Wrong With My Code?
    Replies: 6
    Last Post: November 13th, 2010, 10:41 AM
  5. Action from Radio Button
    By halfwaygone in forum What's Wrong With My Code?
    Replies: 0
    Last Post: April 25th, 2010, 11:52 AM

Tags for this Thread