Reset button problem

Hey I'm writing a program which imitates a real life vending machine. I am however struggling to code in a reset button. The code that I have is:
if (e.getSource() == resetBtn) {
                 if (itemSelectedText.getText().equals("Apple Drops")) {appleDrops++;}
                    itemSelectedText.setText("");
                 amountDueText.setText("");
                 DisableCoinButtons();
            }What this does is it adds 1 back onto the stock of the item that was originally selected, clears the text fields and disables the coin buttons. How ever the problem is that when i select "Apple Drops" then click the reset button, the text is cleared, and the DisableCoinButtons method runs, but I have to press it twice for it to add on 1 to "appleDrops".
Anyone know a solution which will do it with only clicking the reset button once?
Thanks

Is this one of the machines that dispense items using a big corkscrew? They alway jam up on me, too, then I have to buy a second bag of the same item.

Similar Messages

  • JColorChooser Reset button problem

    Hi,
    My default color in my application is Gray.I can change the default background color of my application using the JColorChooser.if i select a color for ex:red and press Ok in JColorChooser the Red Color is set a background Color instead of the default gray.
    Now when i again open the ColorChooser and press Reset i wanted to reset the background color to Gray.Is this possible in ColorChooser?
    Currently whats happening is after chaning my background color from gray to Red and click Reset the red color is reseting.i wanted the gray color to reset.
    I hope iam clear with my explanation.if not i will explain once again.
    Any suggestions or help is highly appriciated.
    Thanks and Regards,
    Ravi

    Here is a link to the section of the tutorial about JColorChooser:
    http://java.sun.com/j2se/1.4.2/docs/api/index.html
    While I have not had the need as of yet to use a JColorChooser, the thought in my mind goes like this: when you are going to replace a value and want it to be there later (for puposes like a reset, then you will need to save that value.) From what I've gotten from the quick glance at the object and the tutorial you need to do this so you can define what the "reset" does in your implementation.

  • Problem with combo boxes and the reset button in certain situations

    Hi Everyone,
    i have a problem to make the reset-button function properly in an what-if analysis dashboard.
    The dashboard uses two combo boxes that are not visible at the same time. In my application the second combo box only appears when a dedicated menu (label based menu button) has been activated.
    So i have combo box 1 when menu A is active an dand combo box 2 when menu 2 is active.
    After starting the dashboard initial values are fine. If you then directly change to menu 2 (seeing combo box 2 with
    the correct default value) and press the reset button, the dashboard returns to the initial view, showing
    the menu 1 with the correct default value. If you now switch back  to menu 2, you will see, that the combo box 2
    is empty (i.e. nothing selected).
    I also tracked the destination cells for the combo box value results as well as the source cells for the "selected item" and the
    destination cells for the "Insert Selected Item". All this values seem to be correct. Therefore i assume that
    this is an issue of event handling. Maybe the combo box 2 does not refresh its selected value because it is already
    invisible when the values are restored.
    This case can easily be simulated by placing two combo boxes and a push button (that changes the visibility of
    the combo boxes) and the reset button on the canvas.
    Maybe someone can help. I am able to provide a test xlf, if neccessary.
    Thanks,
    Oliver
    P.S. I am using Xcelsius SP4 (Version 5.4.0.0)

    Hello Debjit_Singha_86,
    thank you for your support. At the moment i have the following setting:
    label based menu
    - General: Insertion Type "value" from a list of ID's for the menu-items to a dedicated cell (current menu ID, say tab1!$A$1)
    - Behavior: Selected item (position) fixted to item 1
    hidden combo box
    - General: Insertion Type "position" to a dedicated cell with the current choice (say tab1!$B$1)
    - Behavior: Selected item (position) to the same cell (tab1!$B$1)
    Can you give me a hint on how to connect the two components according to your solution, so that the label based menu sets the default for the hidden combox box only in case, that the reset button is pressed?
    Thanks,
    Oliver

  • Problem with reset button

    Hello All,
    I have a form which has several fields. There is a reset button at the top of the Page -1 of the form which should clear/rest  the form. But I have several checkboxes, out of which if some clicked few text fields / drop downs associated with it becomes mandatory. Suppose one clicks Checkbox -1 and the field TextField -1 associated with becomes mandatory.If the user clicks the reset button after clicking the checkbox (which makes the field mandatory) then though the checkbox is unchecked the field remains as  mandatory. How to get over it with ? I have placed the script in the change event as well as in the click event of the text box as there are conditions to met (Suppose there are 3 check boxes associated with a text field and the field becomes mandatory if one of them is clicked) Any help would be greatly appreciated.
    Thanks.
    Bibhu.

    Hi Bibhu,
    It is difficult to say without seeing the form, but a couple of things:
    Try testing against null as well.
    Check the binding on the checkbox on page1 that it has binding of '1' and '0'.
    Double check the object reference for the checkbox on page1, eg is it in another subform.
    Use the JavaScript Console (Control+J when previewing) to see are there any errors when exiting the textfield.
    I would agree with the script being in the exit event.
    I have an aversion to naming design pages with a capital 'P', as this is used for Master Pages, so I would generally use page1, ... page5. This isn't the problem here, just a comment.
    Good luck,
    Niall

  • NF980-G65 Must press reset button to get post boot problem.

    I've seen other posts here & on New Egg where I ordered the MSI 980-G65 Mobo, about when booting for the first time you may find you need to press the reset button to post boot. It seems this is not an isolated problem.
     I read the mobo book while building & read the first thing to do is get into the Bios & load optimized defaults on page En-32. I did that & I always have to press the reset button to post boot every time I start up for the first time. Any self restarts after that are ok. I installed Gskill Ripjaw series DDR3 1600Mhz ram & set the voltage for 1.5v. It booted with ram default @ 1333Mhz. I set the NB freq to 1:4 to set it to 16oo Mhz, I thought it was cuz you have  to OC the settings to get the ram to run @ 1600Mhz. I still had to press reset to get it to post. I know that making any changes other then keeping default settings may cause these problems. I also read here someone else stated to clear the CMOS, move the ram around & it worked for him. I didn't do that.  I decided to load the failsafe defaults, save it, & restart. It booted ok at cold boot. So, back into the Bios I reset all my settings all over again, saved it, rebooted ok from cold start.
     One thing to know, The setting for ganged ram @ 128bit is duel channel mode. The unganged setting puts you in single channel mode @ 64bit.  Useing 2 sticks, 2X2GB in Dimms 1&2 as per the mobo book duel channel mode arrangement. CPUZ will verify that your in duel channel mode.
     My thanks to the person who also posted about this problem.

    Hi
    I hope you don't mind me replying to this thread but it hasa a lot of my problems in it.
    I have just bought an NF980-G65 mob., with an AMD Phenom II X4 955 (Deneb 4c)
    3.2 GHz, DDR3-1333, 2 MB L2, 6 MB. I also bought the G-skill 1600 ram, I was a bit put of when it came as it was for an Intel pro, as stated previous.
    I have it set up with two Nvidia 7800gt G.cards.
    I installed a new hard drive W.Dig. 650gb black. when I tried loading win7 64 i kept getting a blue screen with various faults on it.
    It would work as far as the grey line "loading windows" and even the logo but would then crash.
    The amazing thing is that i put my old hardrive back in and it booted up as 32bit win7 and loaded the drivers.
    this seemed to work until i tried to install a game and it crashed again all i saw was a quick message about "memory"
    needles to say i have returned the g-skill ram as that was the only thing not in the mob recommended ram.
    I am with any ram now and I'm having difficulty finding somewhere that has a stock of recommended ram i.e.
    Patriot PGS34G1600LLKA, GeIL GV34GB1600C8DC, or lots of very expensive Kingston. £100 is about my limit.
    Any way that said, as you are running G-Skill ram do you think i had another problem?
    the one i bought was GSKill 4GB DDR3 Dual Channel Memory Kit (2x2GB) PC3-12800 1600MHz (7-8-7-24)
    Model Number: F3-12800CL7D-4GBRM
    could you confirm the model number of the g-skill in case mine was a differant type.
    thank you

  • My ipad 2 is now version 6.1.3 but hving problem in deleting apps and restoring the unit reset button cant be found

    and i cant restore factory setting because there is no reset button at the settings

    It does matter because it's not meant for normal use.
    You should return it to the seller; they are not suppose to sell you a demo iPad.

  • Problem with SAVE and RESET button in WAD

    Hi all,
    We have two queries embedded in save template and we have created two different save and reset buttons for each query. But if i execute save or reset for one query it is working for both the queries. Can i restrict the SAVE and RESET button for a particular query.

    Hi Tilak,
         It appears that though there are two reset buttons, the HTML code for the webtemplete is not arranged to restrict the reset function of the button for each dataprovider used. This may cause the reset function to act globally on all dataproviders . In the XHTML code, please pass a unique instruction to each reset function, such that each instruction corresponds to a unique dataprovider.
    Thanks,
    Nithin Reddy

  • How to get the submit and Reset buttons on bottom of the page?

    while viewing a parametric form in the web browser i get SUBMIT
    and RESET buttons on the top of the form which doesnt look good.
    I tried pasting the whole html available by default in the
    Before Form Value(where the submit and reset buttons are
    defined) in the After Form Value property of the report property
    pallette. Though the layout appears as i wanted but its not
    passing the parameters values to the query but generates an
    error " REP-0788 Warning : The value of restricted LOV parameter
    BV_FROM_DATE is not among the selected values.". What can be the
    solution to this problem? Your Help is much appreciated. And
    also the report generated in the Runtime Previewer shows all the
    colors of the fields but its not shown on the web browser where
    can i define them...Your Help!!!!Thank you very much in
    advance..

    when you select 'list of values for the parameters' there is a choice box that says 'restrict list to Predetermined values'. Don't select it. This will solve your first problem.
    Second:When you run the report on the web you must choose ' desformat=htmlcss' then you can display the report as in the preview window. But still you can't see the same view in the web browser on report builder. It is still not good. As I sad before you can see the right view when publishing on the web.

  • Page Number Disappesrs when click on Reset button in Dynamic Form

    Dear all,
    In dynamic forms I have taken Page n of m field outside the content area in master pages.I have added the reset button in body pages of the form.In the pdf When I click on Reset button the page nos are disappearing along with the other data.
    I want the page no should not disappear.How can I get rid of this problem. If any body can please help me.
    Thanks a bunch in advance
    Regards
    Rakesh

    Firefox checks on the server if the file has been modified if you use the back button.<br />
    If the page was requested by sending post data to the server then Firefox sends that post data and asks for confirmation.<br />
    You can try to use the tab history of the Back button skip sites that require sending post data.
    You can also try if it works if you set to never check the server by setting the browser.cache.check_doc_frequency pref to 2.
    *http://kb.mozillazine.org/browser.cache.check_doc_frequency

  • Inactive (or broken) reset button on my Ze

    Hello! I recently tried using the recovery tool on my zen V to diagnose any issues. The player had been charging on the computer for some time but was not being recognized by the computer itself (not unusual). So when I tried to use the recovery tool, it obviously said there was no player connected and thus couldn't continue the diagnosis. That is fine and dandy but the problems now are much much worse... After that, I tried removing it and re-plugging it in. The player was detected but not recognized by the computer (strange, I've used it on this computer before). I wasn't overly concerned yet but then the player itself started acting strangely --> freezing while "restoring library". I used the reset button and went to the recovery mode to reboot the player. The player rebooted successfully and restarted the song it had cutoff when the battery died. I tried going to other menus and then the player froze again. Once again, I used the reset button to get into recovery mode and tried to re-boot. It once again froze when trying to restore the library... so I tried the reset button yet again. Finally it loaded, started playing the song again and when I tried switching the menu, it froze YET again! Now, my reset button will not work and it is stuck with the screen on, sitting in the menu section. Does anyone have any suggestions as to what I can do I've owned the player for < year.

    Mark,
    Is the web interface simply not loading or do you not have the password? Your DHCP range does not matter unless there is another device on the network that is currently assigned 192.168.1.254. If that is the case you will have trouble accessing the web UI. It is usually easiest to plug ONLY a PC and the switch together and assign a static IP to the PC:
    IP Address: 192.168.1.200
    Subnet Mask: 255.255.255.0
    Default Gateway: None
    DNS Servers: None
    This will allow you to access the switch without interference from other network devices. Remember to change the PC back to DHCP when you are done. If you do in fact have an IP conflict you should also change the switch to a different static IP.
    You can also access the switch using a console cable. You can check the settings and see if the web interface has been disabled or you can reset the password in case you lost it. Check the Admin Guide for details:
    http://www.cisco.com/en/US/docs/switches/lan/csbms/sf30x_sg30x/administration_guide/78-19308-01.pdf
    Let us know if you have any other questions.
    - Marty

  • Can't include a reset button/process that cleans a search text field

    Hi all
    Using apex 3.0.1 on a XE edition
    In my app there's a report that displays a lot of records.
    I included an text field item, where user can type a search criteria, then i added a button called "search" which, when submitted, display the records where search criteria is included.
    Now, my problem is that i can't put a "reset" button, which, when submmitted, is supposed to clear the search text field, so the report display all records.
    I tried adding a branch that triggers when reset buttos is pressed, clearing cache of search text field. It didn't worked, search string keeps on showing on text field.
    Then i changed the process, instead of clearing cache, setting search text field item with a value of null. Didnt work either...
    Does anyone have a good example of thjis type of reset button???
    tnks in advance....
    Fernando

    yes Earl, i know it's pretty standard...but i got some trouble... anyway, i think it was just a "lapsus brutus" o' mine... It's solved now and here's what i did:
    I created a text field button (where search string will be typed), a "submit as Go" button, and a "submit as reset" button. Then i created an uncondicional branch to same page, then i created a Clear Cache for Item process, where the text field cache is cleared, conditioned when "submit as reset" button is pressed.
    That solved the problem, thnx very much for your help
    fernando

  • Form Reset Button.. works in Pro., Doesn't in Reader

    I created a form in MS Word 2007 and converted to Actobat Pro 9.2.0 and included a reset and print button. 
    When opening the document in Reader 8.1.3, the reset button only resets some of the fields, although all of the fields are checkmarked in the reset dialog.  Also, when I click the print button, nothing happens.  I've created dozens of Acrobat forms with reset and print buttons and this is the first time I've noticed that they aren't working in Reader.
    Both functions work fine in Pro.  Yes, I am sure that the button behavior is linked to a specific action such as >File>Print for the Print Button.  This happens on more than one computer, so I don't think the problem lies with just my machine.
    Any ideas?

    As a test, what happens if you replace the Reset Form action with the following JavaScript?
    // Reset all form fields
    resetForm();

  • Creating a sort of reset button for movieclips

    Hi, i've got 10 movieclips in my movie. I use them for a sort
    of colour sudoku game and i wanted to have a reset button which
    reset them all to the first frame (which is a blank colour) Anyway,
    my problem is that if the movieclip is already on that frame, it
    automatically increments when the button is pressed. Does anyone
    have a solution as to how i would fix this problem?

    post your code...

  • Reset Button in Creator 2 does not work properly

    Hi,
    I have created a form to create a user profile using Studio Creator Update 1. It has a few text fields. It has a checkbox "Add more details" which when clicked enables a few more text fields. At the end of the form I have a Submit and a Reset button.
    Now, when I fill the form (without touching the 'Add more details' checkbox) and click the Reset button, the text fields becomes blank as expencted.
    Lets say I enter some values in a few text field, then I check the checkbox, some more fields gets enabled (i do this inside the processValue method). Now, if I click Reset button, the form does not get blank. Even worst, if I change the already typed text field values and click Reset, these text field gets repopulated with original values. Is this a bug or a feature.
    Any solution for this problem is greatly appretiated.
    Regards,
    Shastri.

    hi i am also developing similar application which have some textfields and submit and reset fields. Please help me how you are sending data to the database table and how you are editing the required rowgroup elements into that submit form from database. Please help me out by giving an example. I alos gone through the inserts_update_delete tutorial in java studio creator. Please give some example of code.
    Actually i am using SQL Server database. Please i tried but it is showing cannot add new employee details. null. Please give me some instances of code for inserting , deleting and retrieving the data. Please help me out i am trying sincerely but it is really get frustrated.
    Thank you in Advance.

  • How can I attach an additional action to the "reset" button in the drag and drop interaction?

    Hello,
    I would like to know how to attach an additional behavior to the "reset" button in my drag and drop exercise.
    Here is the background:
    In my drag and drop exercise, when the user drops the source on a target of his choice, certain elements appear and certain elements disappear
    This means that depending on where he dropped the sources, certain elements will be visible and certain elements invisible when he is finished the activity
    Because the sources are not re-draggable once he drops them, he will have the option to reset the exercise and start again from the beginning using the reset button
    My challenge:
    I would like exercise to return to its original state when the user selects the rest button .  this means:
    the dragged objects return to their orginal starting location (this is what naturally occurs when you hit the reset button)
    any objects that had disappeared during the course of the activity reappear
    objects that were not visible in the beginning , but had appeared during the course of the activity, again become invisible
    So how can I add this action to the reset button?

    Allowing the user to redrag the souce after it has been dropped would work for my particular problem  if I could bind an action to the event redragging, namely making the elements reappear that had disappeared and the elements disappear that had appeared when the user dropped it the first time.

Maybe you are looking for

  • My led and external display flicker a lot. What to do?

    I have a late 2011 MacBook or 15". My MacBook screen/display flickers excessively making the mac completely unusable. I am not sure if flickering is the right term. Some times it flickers and some times turns turs completely blue or black with white

  • Burning with Other Programs?

    I've continually had burning error 4261 preventing me from making CD's with iTunes. Someone suggested burning from iTunes using another program like Nero. I am totally unfamiliar with doing that. How would that work. I like (or did whenever I was mir

  • OO Graphic Engine, how to add Rotation?

    I'm trying to program a simple GameEngine, so far I've created a gameloop (doing stuff, render stuff and wait) Now I want to add to the rendering process a way to rotate every single object with a different angle my object would looke like this: publ

  • Zipfile not recognizing source

    i have a wierd problem. my very simple app sometimes recognizes a .zip file and sometimes throws an unknown source error. the error seems to occur when the zip file was originally created on a mac-- although stuffit can recognize and open these files

  • Default Connection Factory

    The Given Default connection Factory is not working in my MDB.The provided Default is MyJMS Connection Factory under services-jms-connection Factories. if i will give new name then it is working. why default one is not working.           reply me