JRadioButton not getting the Focus Back

Hi,
I am having a problem with the RadioButtons. I have a panel and have three radio buttons belonging to a group. I have selected the third button and saved it to the database. When I came back to the panel, I have the third button selected.But the focus( Rectangle around the text) is on the first button. If I click on the third button then the focus came to the third button. I tried using requestFocus() but its not at all working. Some one please help me asap.
Example of Code...
if(selButton =1)
rb1.setSelected(true);
else if(selButton = 2)
rb2.setSelected(true);
else
rb3.setSelected(true);
TIA,
CK

Did you try:
if(selButton =1) {
  rb1.setSelected(true);
  rb1.requestFocuse();
} else if(selButton = 2) {
  rb2.setSelected(true);
  rb2.requestFocuse();
} else {
  rb3.setSelected(true);
  rb3.requestFocuse();
}Doesn't work ?

Similar Messages

  • JRadio Button not getting the  focus back

    I am having a problem with JRadio Button. I have three buttons in a Panel and I display three different set of sub panels on selecting the corresponding radio button. The top most button is the default one. I selected the second button and saved it to the database. When I come back to the screen, I have the second button selected.But the focus(the rectangle around the text) is on the first button. When I again click on the second button then the focus is coming to the second button. I tried almost everything( requestFocus() etc.,). Can some one help me.
    TIA,
    CK

    Hi!
    Here's some code for simulating your application -- as far as I could understand what it was aimed for... ;-)
    Try this code and let me know...
    (it's a bit long but just paste it)
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.event.*;
    public class Test extends JFrame
    ButtonGroup bg;
    JRadioButton jrb1;
    JRadioButton jrb2;
    JRadioButton jrb3;
    JPanel panel;
    MyItemListener mil = new MyItemListener();
    public Test()
    setSize(600,400);
    Container cp = getContentPane();
    cp.setLayout(null);
    bg = new ButtonGroup();
    jrb1 = new JRadioButton("button 1");
    jrb1.setBounds(10, 10, 200, 20);
    jrb2 = new JRadioButton("button 2");
    jrb2.setBounds(10, 35, 200, 20);
    jrb3 = new JRadioButton("button 3");
    jrb3.setBounds(10, 60, 200, 20);
    bg.add(jrb1);
    bg.add(jrb2);
    bg.add(jrb3);
    JPanel pan = new JPanel();
    pan.setLayout(null);
    pan.setBounds(40, 40, 220, 90);
    pan.setBorder(new EtchedBorder(EtchedBorder.LOWERED));
    pan.add(jrb1);
    pan.add(jrb2);
    pan.add(jrb3);
    cp.add(pan);
    panel = new JPanel();
    panel.setLayout(null);
    panel.setBounds(280, 40, 200, 90);
    panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED));
    cp.add(panel);
    jrb1.addItemListener(mil);
    jrb2.addItemListener(mil);
    jrb3.addItemListener(mil);
    public static void main(String[] args)
    (new Test()).setVisible(true);
    class MyItemListener implements ItemListener
    public void itemStateChanged(ItemEvent e)
    Object source = e.getSource();
    if (source == jrb1)
    jrb1_itemStateChanged(e);
    else if (source == jrb2)
    jrb2_itemStateChanged(e);
    else if (source == jrb3)
    jrb3_itemStateChanged(e);
    public void jrb1_itemStateChanged(ItemEvent e)
    if (jrb1.isSelected()){
    Color color = Color.red;
    panel.setBackground(color);
    // THIS JDIALOG BOX SIMULATES FRAMES THAT MIGHT POP UP
    // DURING DATABASE TRANSACTIONS...
    //======================================================
    JDialog jd = new JDialog();
    jd.setSize(400,300);
    jd.setModal(true);
    jd.getContentPane().setBackground(color);
    jd.setVisible(true);
    public void jrb2_itemStateChanged(ItemEvent e)
    if (jrb2.isSelected()){
    Color color = Color.green;
    panel.setBackground(color);
    // THIS JDIALOG BOX SIMULATES FRAMES THAT MIGHT POP UP
    // DURING DATABASE TRANSACTIONS...
    //=======================================================
    JDialog jd = new JDialog();
    jd.setSize(400,300);
    jd.setModal(true);
    jd.getContentPane().setBackground(color);
    jd.setVisible(true);
    public void jrb3_itemStateChanged(ItemEvent e)
    if (jrb3.isSelected()){
    Color color = Color.yellow;
    panel.setBackground(color);
    // THIS JDIALOG BOX SIMULATES FRAMES THAT MIGHT POP UP
    // DURING DATABASE TRANSACTIONS...
    //======================================================
    JDialog jd = new JDialog();
    jd.setSize(400,300);
    jd.setModal(true);
    jd.getContentPane().setBackground(color);
    jd.setVisible(true);
    cbmn2

  • I deleted the playlists on my iPhone and when I now try to synchronize with my iTunes account to put the music back, nothing happens and I do not get the music back on my iPhone. Anyone who knows why that could be? Grateful for any suggestions!

    I deleted the playlists on my iPhone and when I now try to synchronize with my iTunes account to put the music back, nothing happens and I do not get the music back on my iPhone. Anyone who knows why that could be? Grateful for any suggestions!

    I know it sounds weird, and that is the reason I posted my question.  Because my case is not like all the ones I've found online and it's confusing.  I added a screen capture of my itunes with my old iphone (the one that houses my playlists) connected to it.
    My playlists "ARE"  in my iphone 4s.  They are still there even though they do not show up when I plug in to itunes in my computer. 
    When connecting my phone to itunes on my macbook, the playlists do not appear anywhere in itunes.  I have found my connected iphone icon, I have clicked on the arrow next to it and it does pull up the standard lists that come with the iphone/itunes:  Music, Movies, TV shows, books.  That's it! below that is "Genius" and below "Geniuns" is "PLAYLISTS"  but the only playlist of mine that shows there is one that I created several years back titled "90's music" and that one I created it on my computer, not my phone.  Under "90's music" there are also other standard playlists that itunes automatically adds.
    Does anyone else have this issue or know how to get around this.  I am starting to think that I am going to have to recreate these lists on my computer

  • I make annotations to my photos in iphoto using preview. But once I have made the annotation I do not get the photo back in iphoto into the event from which I took the photo. What am I doing wrong?

    I make annotations to my photos in iphoto using preview. But once I have made the annotation I do not get the photo back into the event in iphoto from which I took the photo. What am I doing wrong? I am not using aperture

    For the annotations to display on the photo in iPhoto you must setup Preview as the external editor in iPhoto via iPhoto's Advanced preference pane.
    After adding the annotations just do a Save.  iPhoto will then recognize the change via a new modified version.  You can revert to the original at any time if you want to get rid of the text.
    OT

  • On my macbook pro the hard drive icon is not on my desktop and I don't know how to find the hard drive or get the icon back on my desktop

    on my macbook pro the hard drive icon is not on my desktop and I don't know how to find the hard drive or get the icon back on my desktop

    Click on the Desktop. From the Finder menu select Preferences. Check the boxes for what you want on your Desktop. If they are already checked, then try unchecking and rechecking.

  • How can I get the tabs back where they belong beneath the address bar , NOT on top ???

    how can I get the tabs back where they belong beneath the address bar , NOT on top ???
    they are on top, which puts the address bar at a variable position depending on how many tab rows exist - makes a moving target for navigating to across my dual 24 inch screens
    I tried your "solution" using about:config and setting browser.tab.on.top or whatever to false, but that had NO effect
    Maybe because TabMixPlus is installed?
    It does allow putting the tabs all the way at the bottom, but I don't like that either.
    PLEASE, give me the address bar at TOP with tabs under that!!!
    Also, I don't want FlashGot to be at the right of the address bar!!!

    why should we use yet another add on to get the tabs back at the bottom? Big mistake.
    Moreover, why make FF look more like Chrome? If I wanted Chrome, i would have installed it long time ago.
    FF 29.0 is NOT an improvement.
    Nasty piece of mud.

  • My computer no longer seesmy 3rd generation ipod nano.  after following the on line directions to re-install I get a message it is ok to discinnect instead of do not disconnect.  how to I get the ipod back onto my computer?

    my computer no longer seesmy 3rd generation ipod nano.  after following the on line directions to re-install I get a message it is ok to discinnect instead of do not disconnect.  how to I get the ipod back onto my computer?

    Hello rh3362,
    I would start with this:
    http://support.apple.com/kb/TS1369
    Hope this helps.
    ~Julian

  • Good morning a few weeks ago  I send the request for the replacement program of my ipod nano 1st generation and they sent me the shipping box but I did not get the label to go back,  and I can not  return it , i need to you sent me again the box for retu

    Good morning a few weeks ago  I send the request for the replacement program of my ipod nano 1st generation and they sent me the shipping box but I did not get the label to go back,  and I can not  return it , i need to you sent me again the box for return the ipod

    Best thing would be to call Apple up again, and let them what has happened and they'll help you!

  • I hit Forget Network and now cannot get back onto my wireless home network. All of my other computers and iphones are fine.  How do I get the network back?  It shows in my list of networks but when I use the password and try to join it says not connected.

    I hit Forget Network and now cannot get back onto my wireless home network. All of my other computers and iphones are fine.  How do I get the network back?  It shows in my list of networks but when I use the password and try to join it says not connected.

    See if the iPad will accept the password after you restart it. It's worth a try.
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    You could also try a reset as well.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

  • HT204370 My movie is not downloading but the movie extras are, how do i get the movie back without re-purchasing it?

    My movie is not downloading but the movie extras are, how do i get the movie back without repurchasing it? I've tried searching through my available downloads but only the extras showed up not the movie. All my other movies are there including the extras from the movie. I really want the movie & I don't want to repurchase it if I can avoid it.
    When I tried to get it through my Purchased in iTunes - iStore it says
    " You have already purchased this item" 
    "You have alreaady purchased this item but it has not been downloaded. To download it, select Check For Avaliable Downloads from the Store menu."
    Which leads me right back to having all the other tv shows & movies that aren't on my laptop downloading but not the actual movie I want. I already have the extras but I really would like the movie .
    Any help or advice would be appreciated
    Thank You

    See Recover your iTunes library from your iPod or iOS device.
    tt2

  • TS3274 The sound on my ipad 2 is not working.  I have a Logitech Keyboard case that I use with my ipad 2.  Last night, the sound quit working.  I've tried everything to get the sound back - still no sound.  HELP!! Please?

    Trying to get the sound working again on my ipad 2.  I have a Logitech keyboard case I use with my ipad 2.  Last night the sound quit but I don't know why.  I've tried everything and can't get the sound back again.  Help!

    HI there,
    There are a couple things you can try. The first thing I would recommend is resetting all settings by going to Settings > General > Reset > Reset All Settings. If that doesn't work, take a look at the article below for additional troubleshooting steps.
    Note: The article title impies that it is for iPhones, but the troubleshooting steps are still aplicable to iPads.
    iPhone: Can't hear through the receiver or speakers
    http://support.apple.com/kb/TS1630
    Hope that helps,
    Griff W.

  • After migrating a new Mac Book Pro from Time Capsule, I noticed that I lost a group of Favorites on the older iMac. The puzzling thing is that the Favorites are on my iPhone--not the old iMac or the new Mac Book Pro. How do I get the Favorites back?

    After migrating a new Mac Book Pro from Time Capsule, I noticed that I lost a group of Favorites on the older iMac. The puzzling thing is that the Favorites are on my iPhone--not the old iMac or the new Mac Book Pro. How do I get the Favorites back?

    If you are syncing using iCloud, try going to System Preferences/iCloud (computers) and checking Safari. If it is checked, try deselecting it, wait 10-15 seconds, and then check it again.

  • Since upgrading to Lion OS, the wifi connectivity keeps blocking up intermittently and we need to manually keep switching on and off the wifi utility to get the connection back. even locking the preferred wifi network in system preferences does not help.

    Since upgrading to Lion OS 10.7.1, the wifi connectivity keeps blocking up intermittently and we need to manually keep switching on and off the wifi utility to get the connection back. even locking the preferred wifi network in system preferences does not help. This never used to happen with Snow Leopard

    This is a big thank you to Rys Sinnefeldt who posted this fix.
    Rys has made this fix very easy to do and takes literally 2 mins. It involves replacing the Atheros Lion driver 4.0 and replacing it with the snow leopard driver. Don't worry, Rys has made this so simple to do even I could do it and so far I have had no more wifi drops.
    follow this link
    http://rys.pixeltards.com/2011/09/04/osx-lion-wifi.html
    Thanks again to Rys.

  • Why am I not getting the buttons of Hide/Show, Refresh, Back, Home, Options ?

    Gorgeous Hello All,
    If anyone of you can please provide me a solution for the following, will help me in plentious and galore.
    Am using Adobe RoboHelp, Version 10 and IE version being 10.
    A hurdle :-
    When I File -> View -> Primary Layout : I am getting only these options of Search, Hide, Contents, Index, Glossary, Print being displayed on the screen, eventhough I have ticked for Hide/Show, Refresh, Back, Home (Home -> Advanced Properties -> Home : and declared the respective url as well) , Options  courtesy View -> Pods -> Project Set-up -> Double Click on Windows -> Double Click on NewWindow.
    Why am I not getting the buttons of Hide/Show, Refresh, Back, Home, Options when I File -> View -> Primary Layout ?
    Cheese - Vipin Nambiar

    Hey Piyush Buddy, where were you since my morning !!! :-) :-) :-)   Your simple question here made me realize where did I make the slip of my brain and now all the desired buttons are appearing on my screen. 
    I just made simple parameter changes called View -> Pods -> Single Source Layouts -> Right Click On Microsoft HTML Help -> Setted as Primary Layout (earlier my Primary Layout was setted up for Multiscreen HTML 5).
    THANKS GALORE Piyush buddy - Your simple question to me made a mammoth and galores of help to get my train on track.

  • Photos 10.10.3 will not let me play or move my videos and keeps sending a message saying "can not find file". What do I do to get the videos back?

    Photos 10.10.3 will not let me play or move my videos and keeps sending a message saying "can not find file". What do I do to get the videos back? It is only during videos that I previously uploaded off my phone. It loads them and tells me how long they are but when I go to press play it says can not find file. I have restarted my computer, what else can I do?

    Check the information on the song, Right-Click -> Get Info.
    In the fist pane, (Summary), you will see the AppleId (Account Name) that was used to buy the song.
    Be sure to login to use this account to register this computer to play the song
    What I often see, Is that people have many different AppleID, sometime not even knowing it, which is a big problem.

Maybe you are looking for

  • MC+A  Report

    Hi All, Return Qty is not updating in MC+A Report(Customer Analysis Return), though I have maintained the settings in OVRO,OVRP. Remaining values like Billing qty, Open order value n it's qty are updating. Could u plz help me in this? Regards, Ramu

  • Multiple SSIDS with VLAN ACL seperation

    Hi, I have bought a 887W and I'm new to wireless on a router, I need advice about seperating multiple SSIDs with access list. I have configured 2 SSIDs one for 'trusted' clients and one for 'guest' clients. I want to prevent the 'guest' SSID obtainin

  • How do I load (internet downloaded) Plug-ins?

    Rather new still to L.E. In another topic, some people talked about a cool plug-in that they used and I went to try it out. I've got it on my desktop, but don't know where I'm supposed to put it. I tried the Library/Audio/Plugins/Components folder bu

  • I want to get Garageband 11 back

    A few days ago I got a new Macbook pro with retina display. It's all up to date, OS X Mavericks and everything. I tried out the new garageband and I must be honest, I don't like it at all. Is there any way to get Garageband 11? (I've checked, there i

  • Close button on skillbuilder modal page

    All, I want to create another button to close my skill builder modal popup page. Ive the default close(X) working well but i want to have another close button at the bottom of the page so one at the top and another at the bottom of the page, i tried