How do I set "JComboBox ItemStateChanged function" to do action only once

I encounter a serious problem with JComboBox.
When I use "ItemStateChanged" function,
I found out it does every action TWICE !!!!!
I need to use "ItemStateChanged" to decrease numbers by 1,
since it does action twice, the numbers are decrease by 2 everytime, which is not what I intended.
Are there anyway I could set "ItemStateChanged" to do the action only once?
Please help me out

The ItemEvent has a getStateChange() method that tells you what the state change was, "selected" vs "deselected". What you are seeing is that each item changes state twice, from delected to selected and vice versa. Check the result of this method to filter out the unwanted state changes.
BTW don't use Choice, its AWT not swing.

Similar Messages

  • How can I set my time capsule to back-up only once a day?

    How can I set my time capsule to only back-up once a day.  It appears to be backing up several times a day.  Not sure there is a set schedule for the back-ups and they take a great deal of time; over an hour each.

    tdenny2 wrote:
    Not sure there is a set schedule for the back-ups and they take a great deal of time; over an hour each.
    Then something is wrong.  Changing the schedule will only deal with the symptom (and give up one of the better features of Time Machine's usually quick and unobtrusive hourly backups).
    See if the size of the backups makes sense, considering what you've changed since the previous one.  If it seems much too large, that may be the problem.  See #D4 in Time Machine - Troubleshooting for some common culprits and ways to see just what's going on.
    If the sizes seem reasonable, see #D2 in the same link for things that can cause extra-slow backups.

  • Using an own function in a select how can i set that the function run once?

    Hi
    Using an own function in a select how can i set that the function run once, not in every row?
    Please help me
    Thanks
    Viktor

    Something like this ?
    SQL> select * from dept;
        DEPTNO DNAME                          LOC
            10 ACCOUNTING                     NEW YORK
            20 RESEARCH                       DALLAS
            30 SALES                          CHICAGO
            40 OPERATIONS                     BOSTON
    SQL> create or replace function ret_name (deptnum in number) return varchar2
      2  is
      3     name    varchar2(50);
      4  begin
      5     select dname into name
      6     from dept
      7     where deptno=deptnum;
      8     return name;
      9  exception
    10     when no_data_found then
    11             return('Not existent deptno');
    12* end;
    SQL> /
    Function created.
    SQL> select deptno, decode(rownum,1,ret_name(deptno),null) dname from dept;
        DEPTNO DNAME
            10 ACCOUNTING
            20
            30
            40
    SQL>

  • How do I set up devices to access my mobile hotspot once its on?

    How do I set up devices to access my mobile hotspot once its on?

        Great question Bnrybtch019. It's important to have access to all your features, I can help you with that. Since you didn't specific a phone model, these are the steps for a popular Android-Operating Phone http://vz.to/1yrBX0e .
    AdaS_VZW
    Follow us on Twitter at @VZWSupport 

  • How do I set up an indicator to display for only 1 second?

    How do I set up an indicator to display for only 1 second?
    I am reading keys from a serial device and I turn on an indicator that corresponds to the key pressed
    on the serial device but how do I set this up so that it only stays lit (enabled) for a second or two?
    The indicator is inside of a case statement and turns on OK but I do not want it to stay on for more than
    a second or two. How do I modify this to display for only a second or two?
     (P.S. I am running an old version 8.2 and can only see vis that are 8.2 or older.)
    thanks

    Simplest way to turn the indicator off (false value) after a set time is to use a Sequence structure (flat or stacked).
    Frame 1, set to true,
    Frame 2, Wait ms (wire millisecond value to wait)
    Frame 3, set to false.
    This method, however, prevents the code outside the case structure from running during that wait time.  
    Something more elaborate will allow the external code to run.  What comes to mind is a shift register that holds the indicator name and the time stamp (in milliseconds) when it was turned on, in an array of clusters.  Each iteration of your loop will check this register to see if a certain time has passed (current time stamp minus turn on time).  If so, use a case structure to turn the indicator off and remove the elements from the shift register array (so you don't keep setting the indicator to false).  The array will let you control multiple indicators independently.
    A problem with this option could arise from multiple readings.  Lets say you want to turn it off after 2 seconds, but you read the value again after 1 second (this means the indicator should be on for a total of 3).  The code would still turn it off after the 2 second mark.  Of course this really depends on the time intervals involved with your code.

  • I have two time capsules, one for work and one for home, how do I set up the work time capsule to only back up my work files?

    I have two time capsules, one for work and one for home, how do I set up the work time capsule to only back up my work files?  Also, how do I add co-workers to my work time capsule and wife to my home time capsule?  Thank you!

    You cannot have two different TC setups.. at least until Mountain Lion.. it did introduce some changes but I am not sure if you can setup two different configurations for TM.. you can use two different devices to back up to. I doubt this will help you.
    You might be better using a real backup software.. superduper, CCC, chronosync etc.
    The TC by default is available to any Mac in the network to do backups. TM will sort itself out and put each computer on a different backup. These are kept in separate sparsebundles.. so that is all fine.

  • HT4053 how to I set my clock's alarm to vibrate only when ringing?

    How do I set my clock's alarm to vibrate only?

    Scroll down and set the Sound to None.

  • How can i arrange that movies and picts are stored only once?, how can i arrange that movies and picts are stored only once?

    how can i arrange that movies and picts are stored only once?, i find them in thumbnail, i movie, imovie thumbnails, and some times in cache.mov or as imovie proyects

    The movies themselves are stored only once. The other files you're seeing are small ones that are used to reference, display and access the main file. If you check the file sizes, you'll see that only one (the movie file itself) is large.
    If you don't want anything saved but the main file, stop using iMovie.

  • How can I set Firefox to print to PDF, the only otions I have are (1) My Canon printer, (2) Fax or (3) Microsoft XPS document writer. There is no option for PDF

    A couple of weeks ago, from the file menu, in my print options was to print a web page to PDF, that facility is no longer there. does anyone know how can I set Firefox to print to PDF.
    The only options I have are (1) My Canon printer, (2) Fax or (3) Microsoft XPS document writer. There is no option for PDF

    Firefox generally displays the printers in Windows' Printers folder (Start orb > Devices and Printers). If it is missing one of the printers listed there, could you indicate which one it is, for example, Adobe Distiller, PrimoPDF, CutePDF Writer, etc.?
    If you previously had an add-on which added print-to-PDF functionality just to Firefox, perhaps it got disabled. You could check here:
    orange Firefox button ''or'' classic Tools menu > Add-ons > Extensions
    Also, are you really running Firefox 8.0.1? That version from last November is no longer secure and has been superseded by Firefox 11. If you browse the web widely, you should update for your security.

  • How can I set up an email user as "send-only" (no mailbox for receiving)?

    Can anyone tell me how I can set up an email account that can send emails but not receive emails.
    Our Web application has been using a generic email address "[email protected]" in all of our PHP Web applications as the sending email account. I have this user set up in WORKGROUP ADMIN as a proper account. However the account gets tons of SPAM emails and is constantly filling up.
    Also, all of the email accounts require SMTP authentication to send emails.
    Is there any way to identify an account as a send only account so we can generate emails from our Web applications that cannot be replied to?
    Thanks for the help
    -- Jon

    Doing so will cause issues. If you send out mail which to an outside server appears to be non existent, mail may be rejected and you may even be blacklisted.
    You can remove the account from WGM and add a role account as an alias send to /dev/null. This will look to the outside world like an existing address, but simply be discarded on your system. You should however include a working address in your mailings for people to be able to respond.
    Assuming you use local domains, edit /etc/postfix/aliases and add:
    noreply: /dev/null
    (you can change noreply with the sender used in your PHP apps, but I'd probably change the PHP apps to use noreply as this signals to people receiving your mails that this address is unattended).
    When done, issue:
    sudo postalias /etc/postfix/aliases
    sudo newaliases
    sudo postfix reload
    HTH,
    Alex

  • How do I set my printer to black and white ONLY?

    I have an HP Photosmart All-In-One C4480.  I don't want to have to buy color cartridges, because I only need black and white, and I have three black and white cartridges already.  How do I set the printer to print my documents in black and white only?
    Thanks,
    TW

    Hi,
    Follow the steps below to print using Black Ink only:
    1. From the application used to print, click the File menu and select Print. The Print window appears.
    NOTE: The Print window might be minimized: Click the Show Details button to see all available settings.
    2. To access the color options, click the lowest selection box listed as the name of the program (e.g. TextEdit)
    Will appear as Copies & Pages within Microsoft Office applications.
    3. Select Paper Type/Quality from the drop-down menu.
    4. Click the triangle next to Color Options to expend the settings.
    5. Set the Color field as Grayscale.
    6. Set the Grayscale Mode as Black Ink Cartridge Only.
    You may save the settings for future use by clicking Presets > Save Current Settings as Preset...
    Any used preset will remain default so simply select teh standard preset to print in color.
    Shlomi
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • How can I set up my Apple TV if I only have one spot for an HDMI cable.

    how do I hook up my apple tv if I only have one spot for an HDMI cable.

    How many different devices (DVD player, cable box, etc.) do you have besides the Apple TV to connect to your TV? If you aren't going to use any of these others, you won't need a switcher.
    Also, depending on the device & what other kinds of inputs your TV might have, you may be able to hook them up to other inputs besides your only HDMI one. The quality might be lower for them, & you might have to use several cables for sound & video, but that might end up being acceptable if you use your ATV much more often than the others.

  • How to search files on a Time Machine backup disk only once perfile

    Greetings,
    Goal: I want to find all user files in a set of Time Machine backups residing on a single disk that contain the string "escalator". Now, there are multiple hard links to each file, so a simple search would search each file multiple times. That would take a very long time. Is there a way that I can search (grep) all text files and mail files only once and list those that contain the string? Note that I only want to search user directories; that is,
    /Volumes/Time Machine Backups/Backups.backupdb/username’s iMac/Latest/Macintosh HD/Users
    where "Latest" can also be any of the dates of all the backups.
    Thanks!

    Well, to clarify:
    I want to find all user text files and mail messages on a Time Machine backup disk that contain the word "escalator".
    By user files I mean those in
    /Volumes/Time Machine Backups/Backups.backupdb/<username>iMac/*/Macintosh HD/Users
    and subdirectories thereof.
    I was trying to use the find command, but it was taking a very long time, so I aborted it. I then realized that most of the files have many hard links, and therefore will be searched many times. That, of course, is a great waste.
    Is there some way to search each file only once?
    Thanks.

  • How do you set up a wireless router for laptops only?

    Recently I purchased the Lynksys WRT54G2 router for my home.  My wife and I both have laptops and NO desktop computer.  How do I hook up the router to work on both our laptops since we dont have a desktop computer?  Thanks.

    Connect one of your Laptop's to the router and configure your router...Once your router is configured you can run both the computers wireless...To configure the router :
    If your ISP is Cable follow the link here...
    If your ISP is DSL follow the link here ,
    this will configure your router for Internet access, now change the wireless settings on your router...
    Click on the Wireless tab on the Setup page- Here Wireless Network mode
    should be mixed- Provide any non linksys network name ....
    Name (SSID) box- Set wireless channel to 11- And wireless SSID
    broadcast should be Enabled and then click on "Save Settings" >>Now
    Click on the Sub tab under wireless > "Wireless Security"
    Change the Wireless security mode to "WEP"...and put a 10 have a note of the key ...
    click save settings ...
    Click on Advanced Wireless settings>>
    Change the Beacon Interval to 75 >>Change the Fragmentation Threshold to 2304 Change the RTS Threshold to 2304 >>Click on "Save Settings" ...
    Try to look for the Wireless Network on both the laptops and connect...

  • Smart Folders - How do I set it to search one particular folder only?

    I want to set up a Smart Folder that will basically do the following:
    1: Look in folder called "Client Work".
    2: Find files modified in the last 1 week.
    That's it. Point 2 I can easily manage, but I can't figure out how on earth I am supposed to set the Smart Folder to only apply its searches to one particular folder on my hard drive? I really can't figure out which option under "Other..." I am supposed to be using.
    I'm sure there must be a simple solution though -- can someone please tell me what it is?
    Thanks!

    On the locations bar in the Finder Search window (where it says Servers Computer Home Others...) pick others and navigate to (with the + button), or drag the folder you want in the window and make sure it is the only folder selected. You will then have another button on the location bar Folder "Client Work". Select that button and save the search as a Smart Folder.

Maybe you are looking for