Problem with making a radio button default

i am making a radio button default using : setSelected(true) method . the radio button is shown as selected but the event that should happen when the radio button gets selected is not done. should fire an event in code? help me out.

private JRadioButton normal_ves_RB = new JRadioButton();
private JRadioButton Barge_ves_RB = new JRadioButton();
ButtonGroup bg=new ButtonGroup();
bg.add(normal_ves_RB);
bg.add(Barge_ves_RB);
normal_ves_RB.setSelected(true); // here i am making this button default. its not firing the event bydefault.
normal_ves_RB.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
normal_ves_RB_actionPerformed(e);
private void normal_ves_RB_actionPerformed(ActionEvent e)
how to make my action performed work when i first run this code by default. setSelected is making the button default but the event is not fired.

Similar Messages

  • Problems with Safari, tabs, radio buttons, etc.

    My goal is (as you probably guessed) to have a script that unite all open windows/tabs in the frontmost window. I know at least of two theoretical ways to do this, but neither works for reasons I don't understand:
    1. GUI scripting. Use Safari's menus to navigate through tabs. For some reason this works somewhat randomly, sometimes getting all tabs and sometimes one tab per window. I can get it working in an awkward way that removes all windows before opening a new one: not exactly what I want to do.
    2. I have found this one browsing for solutions on the web, and it uses the System Events app. It seems that Safari tabs are "radio buttons". However, the number of radio buttons returned is always 0. Also, reading the URL with the line
    value of text field 1 of group 1 of splitter group 1 of window 1
    does not work (returns NSReceiverEvaluationScriptError: 4).
    So, does anyone have any ideas on what goes wrong? (or even better, does anyone have a script that works?)
    Mac mini Core Duo   Mac OS X (10.4.7)  

    Thanks Cyclosaurus, this seems to work!
    There is still one problem: when getting the URL of a window, if it is empty it will throw an "undefined variable" error. How can I avoid this? (I cannot even check if the url is empty because it is undefined.)
    Here is the script I have so far, if anyone is interested:
    tell application "System Events"
    tell process "Safari"
    try
    -- finding the group
    set tab_group to 0
    repeat with g from 1 to count of groups of window 1
    if buttons of group g of window 1 is not {} and title of button 1 of group g of window 1 is not "" then
    set tab_group to g
    exit repeat
    end if
    end repeat
    set URL_list to {}
    set N to count of windows
    repeat with w from N to 2 by -1 -- going through windows
    set T to count of buttons of group tab_group of window w
    repeat with b from 1 to count of buttons of group tab_group of window w -- going through tabs
    click button b of group tab_group of window w
    tell application "Safari" to set this_URL to URL of document w
    if URL_list does not contain this_URL then copy this_URL to end of URL_list
    end repeat
    tell application "Safari" to close window w
    end repeat
    set C to count of URL_list
    repeat with i from 1 to C
    my new_tab()
    tell application "Safari" to set URL of document 1 to item i of URL_list
    end repeat
    on error the error_message number the error_number
    display dialog the error_message buttons {"OK"} default button 1
    end try
    end tell
    end tell
    on new_tab()
    tell application "Safari" to activate
    tell application "System Events"
    tell process "Safari"
    click menu item "New Tab" of menu "File" of menu bar 1
    end tell
    end tell
    end new_tab
    Mac mini Core Duo   Mac OS X (10.4.8)  

  • Problems with the FM Radio after USB connection

    I've been searching around for anyone else having this issue and I though I would ask before I sent my N97 phone in for repair.
    Does anyone have or seen a problem with the FM radio loosing all its frequencies after it has been plugged into the USB charger? Everytime my phone is charged, my radio plays nothing by static. The radio stations are still there, but nothing but static can be heard. I have to reboot my phone to get it working. Since I listen to the radio everyday (the reason I got this phone and my n95) I am constantly rebooting this bloody thing.
    Also, I have a problem rebooting my phone. Sometimes it just won't enable the buttons after the phone has been locked. The side toggle switch doesn't work, and when I touch the screen it says to unlock it. So I'm forced to remove the battery to reboot it. It doesn't happen all the time, happens about 30% of the time.
    Please if anyone can help? I really don't want to send my phone in for repair. 

    Hello,
    Try to remove the n97 battery and keep the "on" button pressed for a few seconds. Then reinsert the battery and turn the phone on. That should get rid of all the accumulated static electricity on the phone. As for your other problem, the only thing I can think of is reinstalling your current firmware and resetting your phone.

  • I have a 7th generation ipod, i have a problem with the pause/play button, it no longer works.

    I have a 7th generation ipod, i have a problem with the pause/play button, it no longer works.
    What does it take to make sure it works ????
    Thanks

    If you successfullt restore to factory defaults/new iPod and still have the problem then it is likely a hardware problem and an appointment at the Genius Bar of an Apple store is in order.

  • Problem with the "mail me" button

    Since I installed both Iweb 09 and Snow Leopard, there is a problem with the "mail me" buttons on my websites. Nothing happens when i click on it even if i see my web adress when my cursor is on the button.
    Do somebody had the same problem and do you know how to avoid it.
    Thanks a lot

    I checked your site and found that the mail me button was not overlapping or touching any other object and positioned entirely in the footer of the page. All looks good and it works for me. You might try moving the button, logo and counter to the bottom of the page content section, publish and see if that makes a difference for those computers that can't.
    Try the following on your Macbook, open Safari, clear the cache (CommandOptionE), load your site and try again. If that makes it work for your MB tell your friends to clear their caches and try again. Might be something as simple as that.

  • Problem with making a database link.

    Hello All
    I got a problem with making a database link.
    When I execute this query
    CREATE PUBLIC DATABASE LINK DBNAME
    CONNECT TO database IDENTIFIED BY name
    USING 'DBNAME.europe.company.com';
    I am using other names because its private information
    But when I look at the table dba_db_links I see this
    OWNER | DB_LINK | USERNAME |HOST
    PUBLIC| DBNAME.europe.company.com| name| DBNAME.europe.company.com
    So the DB_Link name is changed. And this causes a problem with my asp website. I get the fault message
    ORA-02085: database link DBNAME.europe.company.com connects to DBNAME
    Cause: a database link connected to a database with a different name. The connection is rejected.
    The global_names = true and I prefer to keep it that way.
    So does anyone knows what is wrong about my Query or how I can change the DB_Link name.
    Thanks for the support,
    Remco

    Thanks for the help Mohit
    But thats whats I was doing.
    The query in the first post is the same as what you are posting.
    But by an (for me) unknown reason the database converts DBNAME to DBNAME.europe.company.com

  • CRM Survey - How to remove Radio button defaults.

    Hi experts,
    I am trying to remove Radio button default. By default it is selected when I am trying to set attribute for answer options. Even if I unchecked, it reverts and set as selected again. Actually, I need remove Radio button default for the customer sees a response pre filled.
    Please advise on how can I remove Radio button default for answer options.
    Banu

    Hi,
    I see it now.
    You need to change the config of your radio buttons in the transaction itself.
    Goto CRM_SURVEY_SUITE, locate your survey, click on the change button ( a pencil) this will take you to the survey configuration.
    There navigation to the section in the left hand pane that corresponds to the radio buttons. And you will see Yes and No for answers to the questions. Double click on each of them to display on the right side work area and change the property 'Selected' (which is a check box) to unchecked.
    This should be easy.
    Regards
    Prasenjit

  • Having problem with appletv iTunes Radio. Music stops, get spinning wheel, never restarts.

    Having problem with appletv iTunes Radio. Music stops, get spinning wheel, never restarts. If I switch to another station it plays immediately, but it too sometimes stops for the same reason. Wait for 10 minutes for it to restart, then switch stations again. I've tested my download speed when it happens it's fine.

    What was the connection speed when you tested
    Make sure DNS is set to automatic
    Reboot ATV and router
    If on wifi try ethernet

  • I bought an iPhone 5 around fifteen days back and it has already started to give problem with the on/off button. I have to press it five six times to switch it on or off. I am so frustrated by the fact that if I bring it to the service centre, I am going

    I bought an iPhone 5 around fifteen days back and it has already started to give problem with the on/off button. I have to press it five six times to switch it on or off. I am so frustrated by the fact that if I bring it to the service centre, I am going to get a refurbished phone in place of my brand new phone which I just bought. The idea of a used phone repulses me. Any solutions ?

    sumeshdua wrote:
    The idea of a used phone repulses me.
    Why?  Your current phone is used... it has been since the instant it was removed from the shrink wrap and turned on.
    sumeshdua wrote:
    Any solutions ?
    Live with the phone as is.
    Take the device to Apple for evaluation... it may not need replacement.
    Even if it does, neither you or the Apple tech should be able to tell if the replacement is new or refurbished.

  • I anyone having problems with the Sleep/Wake Button?? it doesn't do anything

    I anyone having problems with the Sleep/Wake Button??
    It doesn't do anything

    if you press it and it does nothing, it may be broken. did you drop it?
    try pressing and holding the top power button and round home button on the front for 6-8 seconds and you should see an apple appear.. if you do see the apple, the power button worked.

  • How to Use Switch Statement with Exclusion Group (radio buttons)?

    Wouldn't you know, just when I though I'd really be making progress, I've come across another problem I can't solve. In a homeowners insurance application I am building, there is an exclusion group that needs to set the value of several variables
    I have setup in the form properties/variables. These variables take on different values depending on the users choice.  For the exclusion group, in the object pallet, I have set the binding to normal, and have checked the "Specify Item Values" check box. Also the values for the choices have been assigned 1,2,3,4,5.
    Here is my code for the change event fir the exclusion group (This is exactly what I have tried). For now, the values for the variables to take on in the different cases, are completely arbitrary.
    switch (this.change.rawValue)              // I have tried so many things here
        case "1":                                        // I have tried the caption, single quotes in all combinations
            addLivingExp = "1";
            damageOthersProperty = "2";
            liabilityIncl = "3";
            maxCoverage = "4";
            minCoverage = "5";
            persProperty = "6";
            relatedPrivateStruct = "7";
            break;
        case "2":    
            addLivingExp = "10";
            damageOthersProperty = "20";
            liabilityIncl = "30";
            maxCoverage = "40";
            minCoverage = "50";
            persProperty = "60"
            relatedPrivateStruct = "70";
            break;
        case "3":    
            addLivingExp = "100";
            damageOthersProperty = "200";
            liabilityIncl = "300";
            maxCoverage = "400";
            minCoverage = "500";
            persProperty = "600"
            relatedPrivateStruct = "700";
            break;
        case "4":    
            addLivingExp = "1000";
            damageOthersProperty = "2000";
            liabilityIncl = "3000";
            maxCoverage = "4000";
            minCoverage = "5000";
            persProperty = "6000"
            relatedPrivateStruct = "7000";
            break;   
        case "5":    
            addLivingExp = "10000";
            damageOthersProperty = "20000";
            liabilityIncl = "30000";
            maxCoverage = "40000";
            minCoverage = "50000";
            persProperty = "60000"
            relatedPrivateStruct = "70000";
            break;   
        default:   
            minCoverage= 5;   
            break;
    There must be something obvious I am missing? Eternally grateful for advice on this.
    Stephen

    There are two issues in this script:
    1. You are not using the accessor 'value' to set form variables
    2. You are not correctly getting the value of the radio button list in the switch clause
    Please see the working script below.
    Ben Walsh
    www.avoka.com
    switch (this.rawValue) 
        case "1":                                       
            addLivingExp.value                  = "1";
            damageOthersProperty.value   = "2";
            liabilityIncl.value                      = "3";
            maxCoverage.value                 = "4";
            minCoverage.value                  = "5";
            persProperty.value                  = "6";
            relatedPrivateStruct.value        = "7";
            break;
        case "2":   
            addLivingExp.value                  = "10";
            damageOthersProperty.value   = "20";
            liabilityIncl.value                     = "30";
            maxCoverage.value                 = "40";
            minCoverage.value                  = "50";
            persProperty.value                  = "60"
            relatedPrivateStruct.value        = "70";
            break;
        case "3":   
            addLivingExp.value                 = "100";
            damageOthersProperty.value   = "200";
            liabilityIncl.value                     = "300";
            maxCoverage.value                 = "400";
            minCoverage.value                  = "500";
            persProperty.value                  = "600"
            relatedPrivateStruct.value        = "700";
            break;
        case "4":   
            addLivingExp.value                  = "1000";
            damageOthersProperty.value   = "2000";
            liabilityIncl.value                      = "3000";
            maxCoverage.value                 = "4000";
            minCoverage.value                  = "5000";
            persProperty.value                  = "6000"
            relatedPrivateStruct.value        = "7000";
            break; 
        case "5":   
            addLivingExp.value                  = "10000";
            damageOthersProperty.value   = "20000";
            liabilityIncl.value                      = "30000";
            maxCoverage.value                 = "40000";
            minCoverage.value                  = "50000";
            persProperty.value                  = "60000"
            relatedPrivateStruct.value        = "70000";
            break; 
        default:  
            minCoverage.value                 = 5;  
            break;

  • Problem editing labels of radio button symbols in Fireworks CS6

    Hi,
    I'm new to Fireworks, and I am struggling with symbols. I have encountered several problems creating reusable symbols and especially editing the labels.
    Problem 1
    I can't edit the label of a symbol that I create using a default Common Library symbol as a starting point. Here's how to reproduce:
    - Open a default symbol, say RadioButton(win) for editing
    - Do changes (font for example)
    - Save as a new symbol in the Common Library folder
    - Use the new symbol in a new document
    - Editing the label in symbol instance properties does not work
    Continuing with a rather irrelevant use case just trying to understand what is going on:
    - Add a default symbol RadioButton(win) from the Common Library to the same document
    - Now try editing the label of the new symbol (added to the document above)
    - The label (and other properties) of the default symbol are edited instead
    Problem 2
    Why can I not enter a number as a label of the RadioButton(win) symbol, found in the Common Library? The workaround is simple though, I can just enter a number followed by a space.
    Problem 3
    How to create a set of a heading and three radio buttons as a symbol? If I simply convert three RadioButton(win) symbols and a text element to a new symbol, I lose the possibility to edit the labels of the radion buttons. The properties show that the radio buttons have labels from the time before converting to a new symbol, but in the new symbol the radio button elements have labels that say "label", and I cannot edit them.
    What is the best way to create radio buttons, check boxes, combo boxes and other symbols with custom look and feel, while retaining all the functionality of the symbols?
    Thank you,
    Teemu
    Fireworks CS6 12.0.1.273

    misterMistake wrote:
    > Fireworks v. 9.0.0.1188
    >
    > I have created a 4 state button & saved it to my
    button library. Now I need
    > to modify the graphic but cannot select it. When I first
    click on the "down"
    > state, the graphic is selected along with the "active
    area." If I grab the
    > button I can move it but then it immediately snaps back
    to it's original
    > position. I then cannot select the button again until I
    click to another state
    > and then back again to "down." This problem is not just
    with the "down" state
    > but all states. The documentation makes clear that I can
    just double click on
    > the button, either on the workspace or in the library,
    make my edits and then
    > click "done" in the button editor window. Clearly I've
    either done something
    > incorrect to lock the graphic or my understanding of the
    process is incorrect.
    > Any help appreciated.
    Can you upload a copy of the PNG file to your website for us
    to have a
    look at?
    Linda Rathgeber
    http://www.adobe.com/communities/experts/members/8.html

  • Had problem with bookmarks, history, back button and google links not working.

    For the last five days i've had problems with firefox. First, i noticed that it was running incredibly slowly and then that all the links in the google search were not working. Then i noticed that neither was the history, bookmarks or back button. I went on to facebook chat to ask for help. First, I was told to reinstall firefox, which didn't work. Then i was told to do a "clean" install where you rename the old firefox folder in the programs folder so that it makes sure when it's installed that everything is new and nothing is corrupted. That didn't work either. I then disabled my antivirus software and firewall to see if that was causing the problem. It was not. Then I installed an anti-malware program to remove any adware or spywar,e which it did remove from my computer, but it didn't solve the problem. The chat person was at a loss and I don't blame him/her because so was I.
    The reason I'm writing this is in case anyone else has the same problem. The only way I solved it was first by uninstalling and making sure to check the little box asking if you want all personal data and such associated with firefox also removed (which removes cookies as well) and then I finally thought to delete all the cookies from the rest of my computer also. Once all the cookies were gone and i had fully uninstalled firefox and personal data, I reinstalled it with a newly downloaded file and it is once again functioning properly. Hope this is helpful to anyone who's been ripping their hair out. :)

    '''I have the same problem!!
    But in my case, not just Google links.
    The problem happens with all the websites links.
    Please...
    Help us!!
    Thnx'''

  • OS X Lion Server display problem with menu highlighting and button icons

    I have attached  Grab capture of my screen showing the problems with the window top bars and button icons. This happened after a routine security update.
    Does anyone have an idea how to fix this?
    Thanks
    George Harrison

    I have/had the same problem. Comparible setup running Lion Server GM. The natd service fires off the InternetSharing service from the prefspane instead of the regular natd service. This is verifiable by entries in the system log as well as the lack of the natd process running. Below are my findings from research/experimentation; please understand that this is what I have done to get it working, it is DEFINITELY not best practices and I'm sure not supported by Apple. I'm just conveying what I think is happening and how I dealt with it.
    Natd - Executing the binary referenced in the launchctl job directly launches the InternetSharing service on Lion server. This does NOT act this way in SL server, where it works as expected. Replacing the Lion binaries with The SL ones results in natd working as expected: nat_start and nat_stop in /usr/libexec. In short, if you replace the Lion binaries with the ones from SL, it-s a drop-in fix. Natd isn't your only problem though...
    Dns/named - It appears that Apple has limited named to binding on the loopback adapter only by default on Lion. Adding a listen-on clause to named.conf with the appropriate bindings will fix this. I'm assuming you're running natd, named and dhcpd on the same box...
    Dhcpd - Works fine. It appears broken only because the InternetSharing service is replacing natd (why?!?) and it has a built-in dhcpd server (dumbed down 192.168.2.0 subnet). Once you fix natd, this runs as expected.
    Firewall/ipfw - Gotta have this running so that natd will do translation. Remember to open the dhcp ports to allow the clients to get leases...
    I hope this helps, I'm sticking with SL until these issues are worked out...

  • Radio Buttons Defaulting to YES when form is saved

    Hello, I'm researching a problem a user has informed me of, and I haven't seen this topic listed anywhere, nor have I been able to figure out why the problem is happening.
    My form has 5 radio button exclusion groups, each with a YES or NO selection.
    When the form is saved with a selection of NO for each group then re-opened, the selected value has changed to YES for all but the first group.
    Anyone have an idea why this is happening?

    Is there any script on the form that could be changing the values after loading?
    As a test, add a button on the form and use this code on the click event:
    xfa.host.exportData();
    When the button is clicked, it will allow the user to choose a filename to save the data into (it will have an XDP extension). Once it is saved change the extension to XML and open it in your browser. Check and see that those button groups are being set. If they are not it could be that they are not bound correctly. Check to see if the Binding is set to none (if so you are excluding these from your data).
    Hope that helps.

Maybe you are looking for