Code to reset an Applet?

Is there some command I can call to reset a java applet, mainly this one?
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
     public class TTTApplet extends JApplet implements ActionListener
             String player_turn;
          int clicks;
          boolean finished;
          JButton NW = new JButton("");
          JButton N  = new JButton("");
          JButton NE = new JButton("");
          JButton W  = new JButton("");
          JButton C  = new JButton("");
          JButton E  = new JButton("");
          JButton SW = new JButton("");
          JButton S  = new JButton("");
             JButton SE = new JButton("");
     public void init ()
           NW.addActionListener (this);
        N.addActionListener(this);
        NE.addActionListener(this);
        W.addActionListener (this);
        C.addActionListener(this);
        E.addActionListener(this);
        SW.addActionListener (this);
        S.addActionListener(this);
        SE.addActionListener(this);
        this.add(NW);
        this.add(N);
        this.add(NE);
        this.add(W);
        this.add(C);
        this.add(E);
        this.add(SW);
        this.add(S);
        this.add(SE);
        player_turn = "X";
        clicks = 0;
        finished = false;
        setLayout(new GridLayout(3,3));
     public void actionPerformed(ActionEvent e)
          Object source = e.getSource ();
         JOptionPane Mine = new JOptionPane();
         /* WINNING COMBINATIONS
               NW + N + NE
               W + C + E
               SW + S + SE
               NW + W + SW
               N + C + S
               NE + E + SE
               NW + C + SE
               NE + C + SW
          if (source == NW)
               if(player_turn == "X" )
                 NW.setText("X");
                player_turn = "O";
            else
                 NW.setText("O");
                 player_turn = "X";
               clicks++;
               NW.setEnabled(false);
          else if (source == N)
             if(player_turn == "X" )
                 N.setText("X");
                player_turn = "O";
            else
                 N.setText("O");
               player_turn = "X";
            clicks++;
             N.setEnabled(false);
          else if (source == NE)
             if(player_turn == "X" )
                 NE.setText("X");
                player_turn = "O";
            else
                 NE.setText("O");
                player_turn = "X";
            clicks++;
              NE.setEnabled(false);
          else if (source == W)
               if(player_turn == "X" )
                 W.setText("X");
                player_turn = "O";
            else
                W.setText("O");
                player_turn = "X";
            clicks++;
            W.setEnabled(false);
        else if (source == C)
             if(player_turn == "X" )
                 C.setText("X");
                player_turn = "O";
            else
                    C.setText("O");
                player_turn = "X";
            clicks++;
            C.setEnabled(false);
        else if (source == E)
             if(player_turn == "X" )
                 E.setText("X");
                player_turn = "O";
            else
                E.setText("O");
                player_turn = "X";
            clicks++;
            E.setEnabled(false);
        else if (source == SW)
             if(player_turn == "X" )
                 SW.setText("X");
                player_turn = "O";
            else
                 SW.setText("O");
                player_turn = "X";
            clicks++;
            SW.setEnabled(false);
        else if (source == S)
             if(player_turn == "X" )
                 S.setText("X");
                player_turn = "O";
            else
                    S.setText("O");
                player_turn = "X";
            clicks++;
            S.setEnabled(false);
        else if (source == SE)
             if(player_turn == "X" )
                 SE.setText("X");
                player_turn = "O";
            else
                 SE.setText("O");
                player_turn = "X";
            clicks++;
                SE.setEnabled(false);
        if ((NW.getText() == N.getText()) && (N.getText() == NE.getText()))
             if (NW.getText() != "")
                    finished = true;
                 Mine.showMessageDialog(this, (NW.getText() + " is this winner!"));
        if ((W.getText() == C.getText()) && (C.getText() == E.getText()))
                 if (W.getText() != "")
                 finished = true;
                 Mine.showMessageDialog(this, (W.getText() + " is this winner!"));
        if ((SW.getText() == S.getText()) && (S.getText() == SE.getText()))
                 if (SW.getText() != "")
                 finished = true;
                 Mine.showMessageDialog(this, (SW.getText() + " is this winner!"));
        if ((NW.getText() == W.getText()) && (W.getText() == SW.getText()))
                 if (NW.getText() != "")
                 finished = true;
                  Mine.showMessageDialog(this, (NW.getText() + " is this winner!"));
        if ((N.getText() == C.getText()) && (C.getText() == S.getText()))
                 if (N.getText() != "")
                 finished = true;
                 Mine.showMessageDialog(this, (N.getText() + " is this winner!"));
        if ((NE.getText() == E.getText()) && (E.getText() == SE.getText()))
                 if (NE.getText() != "")
                 finished = true;
                 Mine.showMessageDialog(this, (NE.getText() + " is this winner!"));
        if ((NW.getText() == C.getText()) && (C.getText() == SE.getText()))
             if (NW.getText() != "")
                 finished = true;
                 Mine.showMessageDialog(this, (NW.getText() + " is this winner!"));
        if ((NE.getText() == C.getText()) && (C.getText() == SW.getText()))
             if (NE.getText() != "")
                 finished = true;
                 Mine.showMessageDialog(this, (NE.getText() + " is this winner!"));
          if(finished == true)
               init();
        if ((clicks == 9) && (finished == false))
             Mine.showMessageDialog(this, "Tie Game!");
             init();
     }Ive tried just typing init() in the last two If checks, but that doesnt seem to work.
The reason I want to reset it is because, upon winning (displaying the message box), you can still click the buttons. I did discover that typing setEnabled(false), will make it so no more clicking can happen.....Then the game may be reset by refreshing the page....but, I would rather have it auto reset over and over until you close it.

simple, just write some code to reset all you buttons and stuff to their begining state using a method...
example...
public void resetGame(){
               NW.setText("");
               N.setText("");
               NE.setText("");
               W.setText("");
               C.setText("");
               E.setText("");
               SW.setText("");
               S.setText("");
               SE.setText("");
               NW.setEnabled(true);
               N.setEnabled(true);
               NE.setEnabled(true);
               W.setEnabled(true);
               C.setEnabled(true);
               E.setEnabled(true);
               SW.setEnabled(true);
               S.setEnabled(true);
               SE.setEnabled(true);
               clicks = 0;
               finished = false;
        }then call this method when you want to reset that buttons and stuff...
- MaxxDmg...
- ' He who never sleeps... '

Similar Messages

  • T-code that  resets the counts in the storage bins

    hello,
    is there any T-code that  resets the counts in the storage bins.
    As we do our weekly counts it keeps a running total of how many bin are completed and allows us to track the warehouse's progress.
    Regards
    Goutham

    Of cource, very sorry to waste your time,
    I didn't even notice LOL
    But your question is a easy question so I am sure some one will respond with a good answer for you.
    our program name is RLREOLPQ
    not sure if the program is custon or just t-code
    gl
    Edit: may be a bad sign for you, maybe no standard t-code if we had to create a custum one
    Edited by: Arakish on Apr 1, 2010 10:32 PM

  • Why can't I send a code to reset my security questions but I have a rescue email address?

    Why can't I send a code to reset my security questions but I have a rescue email address?

    If you have a rescue email address on your account then you will see a reset link on your account : http://support.apple.com/kb/HT6170
    If you only have alternate/secondary email addresses on your account then you won't get the reset link, an you won't be able to add a rescue email address until you can answer your questions - you will have to contact Support in your country to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/kb/HT5699
    If your country isn't on that page then try this form and explain and see what they reply with : https://ssl.apple.com/emea/support/itunes/contact.html
    When they've been reset you can then add one for potential future use : http://support.apple.com/kb/HT5620

  • I have entered the wrong numbers to put my phone in pass code lock.  However, I didn't set the autolock....how can I get the pass code lock reset?

    I have entered the wrong numbers to put my phone in pass code lock.  However, I didn't set the autolock....how can I get the pass code lock reset?

    Your only choice is to place the phone in DFU mode (search Google for instructions) and restore as a new device.  You will lose all your data.

  • "SignalNthResponder(): error code not reset" upon opening Indesign CS2 Debug

    I've been using InDesign CS2 Debug (with IDCS2_Updater_Roman_Debug_2.exe file version 4.1.100.1332 applied) on Windows XP for several months with no problems, but lately I've been getting the following sequence of errors upon opening InDesign, which causes InDesign to shutdown. It also occurs before code flow even reaches the constructor for my plug-in so I have no idea what is causing it.
    1. (ASSERT) SignalMgr::SignalNthResponder(): error code not reset
    2. (ASSERT) Putting up an alert when the global error state is not kSuccess can cause crashes if a command is fired while the alert is up! Try moving call to ErrorUtils::PMSetGlobalErrorCode(kSuccess) to before call to CAlert::ErrorAlert.
    3. (Adobe InDesign) Adobe InDesign is shutting down. A serious error was detected. Please restart InDesign to recover work in any unsaved InDesign documents.
    4. (ASSERT) ProtectiveShutdown - Debugger break
    5. Then it shuts down.
    But of course restarting InDesign only repeats these messages. Restarting the computer does nothing to help. The only way I have found to alleviate the problem is to uninstall and reinstall InDesign Debug. But then after using InDesign Debug for a couple of days without problems, this sequence reappears. Anyone know how to end this vicious cycle?
    Thanks,
    Miles

    I've been using InDesign CS2 Debug (with IDCS2_Updater_Roman_Debug_2.exe file version 4.1.100.1332 applied) on Windows XP for several months with no problems, but lately I've been getting the following sequence of errors upon opening InDesign, which causes InDesign to shutdown. It also occurs before code flow even reaches the constructor for my plug-in so I have no idea what is causing it.
    1. (ASSERT) SignalMgr::SignalNthResponder(): error code not reset
    2. (ASSERT) Putting up an alert when the global error state is not kSuccess can cause crashes if a command is fired while the alert is up! Try moving call to ErrorUtils::PMSetGlobalErrorCode(kSuccess) to before call to CAlert::ErrorAlert.
    3. (Adobe InDesign) Adobe InDesign is shutting down. A serious error was detected. Please restart InDesign to recover work in any unsaved InDesign documents.
    4. (ASSERT) ProtectiveShutdown - Debugger break
    5. Then it shuts down.
    But of course restarting InDesign only repeats these messages. Restarting the computer does nothing to help. The only way I have found to alleviate the problem is to uninstall and reinstall InDesign Debug. But then after using InDesign Debug for a couple of days without problems, this sequence reappears. Anyone know how to end this vicious cycle?
    Thanks,
    Miles

  • I bought a used iPod touch for my daughter and I do not have reset code to reset the device. What can I do?

    I bought a used iPod touch for my daughter and I do not have a code to reset it....neither does the seller.  What can I do?

    that would sound all my alarm bells if this device is stolen.

  • HT5661 i have an iphone 3gs that i want to sell but can not remember my restriction code to reset my phone

    i have an iphone 3gs that i want to sell but cant remember the restriction code to reset my phone

    Connect to iTunes & hit the restore button on the Summary Pane. This will restore as a new device. Eject when finished.

  • I'm trying to pay for a game, and I went to pay it's asked security questions and I don't remember what I answered and I went to resend code to reset the answer and the email starts with an a and I have no email that starts with an s

    I'm trying to pay for a game, and I went to pay it's asked security questions and I don't remember what I answered and I went to resend code to reset the answer and the email starts with an a and I have no email that starts with an s

    See Kappy’s great User Tips.
    See my User Tip for some help: Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities
    https://discussions.apple.com/docs/DOC-4551
    Rescue email address and how to reset Apple ID security questions
    http://support.apple.com/kb/HT5312
    Send Apple an email request for help at: Apple - Support - iTunes Store - Contact Us http://www.apple.com/emea/support/itunes/contact.html
    Call Apple Support in your country: Customer Service: Contacting Apple for support and service http://support.apple.com/kb/HE57
    About Apple ID security questions
    http://support.apple.com/kb/HT5665
     Cheers, Tom 

  • Creating Z program for T code FBRA (resetting cleared item)

    HI ABAP Gurus,
    I have a requirement , please Help me.
    One of my client Has executed APP program. through with 100 items are cleared. later they identified those invoice should not be cleared. To Reset this cleared item we have T code FBRA through which we can reset single line item each time.
    So we need to develop a new program for Resetting all the items at one instance. Please guide how configure this??
    Thanks in Advance
    Babu

    Yes AFAIK there is no standard report so you have to create your own with usage of FM POSTING_INTERFACE_RESET_CLEAR (*) "Jus" change the parameter of FBRA into SELECT-OPTIONS.
    Regards,
    Raymond
    (*) FI Financial Accounting: Data Transfer Workbench; Accounting Documents: Data Transfer Workbench, Using the Internal Posting Interface.

  • Forgot lock code & Hard reset

    Hi friends,
    hope my post will find you all in healthy state. I have two queries and shall be very thankful to you if you guide me accordingly:
    Q1: I want to restore factory settings of my N900, but unfortunately forgot the lock code. How lock code can be renewed?
    Q2: I want to hard reset my N900, does any one has some simpler and straight forward process?
    Thanks a lot in advance.
    Nabeel ur Rehman
    Nabeel ur Rehman

    nabeelurrehman wrote:
    Hi friends,
    hope my post will find you all in healthy state. I have two queries and shall be very thankful to you if you guide me accordingly:
    Q1: I want to restore factory settings of my N900, but unfortunately forgot the lock code. How lock code can be renewed?
    Q2: I want to hard reset my N900, does any one has some simpler and straight forward process?
    Thanks a lot in advance.
    Nabeel ur Rehman
    the ONLY way to reset the lock code if you forgot it is to flash your device with flasher3.5.  you will have to flash both the os and the EMMC.
    you can follow my directions HERE
    since you wanted to reset your device and start over, this will make your device just as if you took it out of the box for the first time.

  • Want code for reset

    Hello Gurus..
    I have a page that has the Create button and Reset button...I want to reset the values of my fields and i want to write a code for it.So please help with the code....

    There is no single coding solution to do this. If you want to reset to some original values, then most people will re-run the query method that they used to fill the context in the first place.  Basically you want to reset the data in the context.  If you really want to go back to the empty state of the context, then try the INVALIDATE method of the context node or bind an empty table/structure to each context node you are using.

  • How can i get secuirty code to reset factory setti...

    Please help me out.
    Thank you

    12345 is the default security code unless it was changed. If you changed it and can't remember it then you can get it reset at your local Nokia Care Point. You need to bring proof of purchase with you.
    You can locate your nearest care point using the link below.
    ww.nokia.com/support

  • Return Code of the Tag applet /applet

    Does someone has deal with return code in the applet tag
    <applet codebase="http://10.15.1.26/printcndconjunta/"
         code="AppletHTMLPrint.class" width=710 height=500 id=Applet1 VIEWASTEXT>
    <param name="ConectionLink" value=<%=ConnectionString%>>
    </applet>
    Example : AppletHTMLPrint.class return 1 with someone used exit options.
    In resume , I want to close my HTML page (ASP one) after finished using my Applet, the way is going now it does not close the page
    where the applet was running after applet exit.

    If you Google for "applet javascript communications" you will be able to find out how to make the applet call a Javascript function which could in turn close the window.

  • Run Priviliged Code in a Java Applet

    I am calling a Java applet from Javascript. The Java code needs to run in privileged mode.  Eventually it is going to display a file chooser which will display files from the local hard disk, but for now it just returns a simple dummy value.  The problem I am having is that the call from JavaScript to Java returns PrivilegedActionException. The applet is in a signed Jar file.  I'm running 8u25.
    Here's the Java class:
        // Java code
        public class OHLib extends Applet {
            public String getFile() {
                String result;
                try {
                    result = (String) AccessController.doPrivileged(new PrivilegedAction() {
                        public String run() {
                            // JFileChooser code will go here
                            return "xxx";
                } catch (Exception e) {
                    e.printStackTrace();
                return result;
    Can anybody tell me what's wrong with this code?  I would also be interested to know why the above try/catch block is not catching the exception.  The only place I see the exception is in the browser F12 developer tools.
    Here's the JavaScript code:
        function BrowseForFile() {
            var x;
            try {
                 // this code generates PrivilegedActionException
                 x = ohApplet.getFile();
            } catch (e) {
                 console.log(e);
    The applet is deployed on my web page as follows:
    <script src="/plugins/deployJava.js"></script>
    <script>
         var attributes = {
             id:'ohApplet',
             code:'OHLib',
             codebase: 'java',
             archive: 'OHLib.jar',
             width:1,
             height:1,
         var parameters = {
          jnlp_href: 'OHLib.jnlp',
          classloader_cache: 'false',
         deployJava.runApplet(attributes, parameters, '1.8');
    <script>
    The applet is in a signed jar file, with the following manifest:
    Application-Name: <appname>
    Permissions: all-permissions
    Codebase: <domain>.dev <domain>.com
    Caller-Allowable-Codebase: <domain>.dev <domain>.com
    Application-Library-Allowable-Codebase: <domain>.dev <domain>.com
    The JNLP file is as follows:
        <?xml version="1.0" encoding="UTF-8"?>
        <jnlp spec="1.0+" codebase="" href="">
            <information>
                <title>title</title>
                <vendor>vendor</vendor>
            </information>
            <security>
                <all-permissions />
            </security>
            <resources>
                <j2se version="1.8+" href="http://java.sun.com/products/autodl/j2se" />
                <jar href="OHLib.jar" main="true" />
            </resources>
            <applet-desc
                 main-class="OHLib"
                 name="OHLib"
                 width="1"
                 height="1">
             </applet-desc>
        </jnlp>       

    The problem was that I was not including the anonymous inner class (OHLib$1.class) in the jar file. My original jar command looked like this:
    jar cfmv OHLib.jar "../../jar_manifest.txt" OHLib.class
    Changing it to below fixed the problem:
    jar cfmv OHLib.jar "../../jar_manifest.txt" OHLib.class OHLib$1.class
    Credits go to this page  for the solution.

  • Lock code after reset to factory settings

    I have changed my lock code from default and I remember it. Since I had some software issues, I reset the phone (Nokia 5230) to factory settings by giving the lock code.
    Today when I enter (after resetting) my personal lock code, the phone didn't accept it. I tryied several times and got a warning message.  Will my phone become locked permanently if I enter the wrong lock code again? What should I do? Please help.
    Solved!
    Go to Solution.

    You get locked out for increasing lengths of time before you can input another lock code upon repeated tries. Although it should not have changed, presumably you tried factory default of 12345 as one of your attempts? If all else fails a visit to Nokia Care facility with proof of purchase beckons.
    Happy to have helped forum in a small way with a Support Ratio = 37.0

Maybe you are looking for