Reloading Applet w/ a button....

I have a tic tac toe game i just made, it pretty much works fine, except for few minor technical errors (such as the next player text being dispalyed after a win has occured.)
However, what I would like to do is add a button that says "Play Again". Since I know how to add buttons that part is easy enough. What I don't know, and can't find easily, is how to add code that will make the applet reload upon the button press.
I am looking for the easiest AND most efficient way possible. Thank you.

Well I dont understand why you cant make an endless loop inside the applet insted of reloading the applet?
this maybe work
URL url;
then in the code
do this
try{
url=new URL("adress of the html page");
catch(MalformedURLException e){
getAppletContext().showDocument(url);
this gets the applet to call the browser to load a specific html page, if you put the same adress, it will probably reload it.
you also need to import those to make it work
import java.net.URL;
import java.net.MalformedURLException;
hope this helps

Similar Messages

  • When i hit the back button, the web page can not reload ! and this button is disable ! I'm using Ubuntu 10.04 Lucid ! and I've just upgrade to firefox 4 RC. Sorry for my poor English skill !

    When i hit the back button, the web page can not reload ! and this button is disable ! I'm using Ubuntu 10.04 Lucid ! and I've just upgrade to firefox 4 RC. Sorry for my poor English skill !

    In Firefox 23 versions and later the keyword.URL pref is no longer supported and it is no longer possible to specify the search engine for the location bar via the keyword.URL pref.<br />
    The search engine that is used on the location bar and on the about:home page is the search engine that is selected in the search Bar on the Navigation Toolbar.<br />
    Current Firefox versions do not update the about:home home page until you refresh the page (future versions will do this automatically without a refresh) and that is what happens if you use the Back key.
    You can install the Keyword Search extension to specify with search engine to use for the location bar and which search engine to use for the about:home page via the Options/Preferences windows of this extension, accessible via the about:addons page.
    * Keyword Search: https://addons.mozilla.org/firefox/addon/keyword-search/

  • How to reload applet?

    I want to reload applet by the program. In the program, under some condition, I want to reload the applet. Please let me know how can I implement it.
    Thanks & Regards,
    Nasrin.N

    Hey fuckwit!
    Please stop multiposting every single question you have into three or four different forums.
    Thank you for your co-operation in this matter.

  • Reloading applet

    Hi all!
    I have been searching for a while for a code that would let me reload my Applet, but I haven't found anything really. Would anyone be able to tell me if there's a code that would allow that to happen.
    It's just that I've created an Applet and there's a button whose event handler must restart the whole Applet but up to now it's not operating at all. I would be grateful if somebody could answer me this.
    Yours,
    Saulo

    All I need is to make the same graphics from the start of the Applet to be displayed once a certain button is clicked. I thought that by realoading the Applet the result would be the same... I tried to put reapeat the code I've written for the beginning on the instance where the button is but that caused me a series of errors. I wonder what that might be, as all I had were components of a paint method.
    Regards,
    Saulo

  • Reload applet from server

    Hi,
    I have an applet 'appl.java' which takes an data.xml file(exists on server), the applet is embedded on a web page. A button is also provided on the web page. When the user clicks on that button the server updates the data.xml file(on the server), now I need to reload the data.xml file as input to the applet. so i decided to refresh the page so that the applet gets reloaded but the applet does not process the new data.xml file. How should I reload the applet on the page with new data.xml?

    Hi Rajesh,
    Verify that file data.xml is not in a directory with a content expiration set.
    If so, the explorer will retrive it from cache.
    Regards, Gustavo Oga

  • How do I disable the reload on the back button of Firefox and have it display the cached/prior page version?

    Every time I click the "back" button, Firefox reloads the previous page I was on. How do I disable the reload and have Firefox display the cached/prior page version? The whole point of going "back" is to see what we were just looking at.. I don't want a refreshed version of it. Any help would be greatly appreciated! I am running version 3.6.12.

    No problem. It's not a request that's been seen much if at all to be honest. I rely on them myself.
    You can always feel free to provide feedback to Apple though.
    http://www.apple.com/feedback/

  • How do I get the Home, Reload and Forward/Backward buttons grouped logically together, rather than splattered randomly across the top of the browser ?

    In Firefox 3, all the buttons are grouped together, in V4 they are now scattered across the top of the browser, aping IE7/8 - plus the "stop loading" button has gone walkabout - it would be useful to get that back, as well.

    You can open the Customize window to make it possible to change the position of those toolbar buttons.
    Open the Customize window via "View > Toolbars > Customize" or via "Firefox > Options > Toolbar Layout"<br />
    * Drag the Home button from its current position at the right to the previous position at the left of the location bar.
    * Drag the Reload and Stop buttons to their previous position at the left side of the location bar.
    * Set the order to "Reload - Stop" to get a combined "Reload/Stop" button.
    * Set the order to "Stop - Reload" or separate them otherwise to get two distinct buttons.
    See also:
    * http://kb.mozillazine.org/Toolbar_customization

  • Reloading applet in opera throws NullPointerException in SunGraphics2D

    i have an Applet, which checks for Sun JVM. If MS JVM, it aborts. If Sun JVM, it starts new JApplet.
    Everything is working fine, until i tried to reload the html page with the applet tag in it.
    On MS IE, it is working. The Applet is stopped and then restarted.
    On Mozilla, it is working.
    But on Opera, the following Exception is thrown after i have reloaded the page once.
    After reloading, the Exception is also thrown everytime i scroll the page or reload the page.
    java.lang.NullPointerException
         at sun.java2d.SunGraphics2D.<init>(Unknown Source)
         at sun.awt.image.SunVolatileImage.createGraphics(Unknown Source)
         at java.awt.image.VolatileImage.getGraphics(Unknown Source)
         at javax.swing.JComponent.paintWithOffscreenBuffer(Unknown Source)
         at javax.swing.JComponent.paintDoubleBuffered(Unknown Source)
         at javax.swing.JComponent.paint(Unknown Source)
         at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
         at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
         at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
         at java.awt.Container.paint(Unknown Source)
         at sun.awt.RepaintArea.paint(Unknown Source)
         at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    As said, i'm using an Applet class and an JApplet class. the Applet class has only AWT components,
    the JApplet class has swing components (a list and a few JButtons).
    i'm using a thread, but it is not started.
    also, after the reload in opera, the whole applet is started again (as usual), and AFTER the last debug message,
    this exception is thrown. so there is no code of myself after that last debug message.
    i am using java 1.4.2-beta, but users told me they have the same problem with my applet on other computers with
    other jvms.

    i tried a beta-version of opera 7.20 and here are some source code line numbers visible:
    perhaps someone can tell me now, what's happening there and give me a tipp how to solve this problem.
    java.lang.NullPointerException
    at sun.java2d.SunGraphics2D.<init>(SunGraphics2D.java:212)
    at sun.awt.image.SunVolatileImage.createGraphics(SunVolatileImage.java:176)
    at java.awt.image.VolatileImage.getGraphics(VolatileImage.java:223)
    at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4768)
    at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4748)
    at javax.swing.JComponent.paint(JComponent.java:798)
    at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
    at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
    at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
    at java.awt.Container.paint(Container.java:1312)
    at sun.awt.RepaintArea.paint(RepaintArea.java:177)
    at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:260)
    at java.awt.Component.dispatchEventImpl(Component.java:3678)
    at java.awt.Container.dispatchEventImpl(Container.java:1627)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

  • Applet label and button attributes being reset.

    Using JDK 1.4 through 1.6, IE6, JBuilder 2005
    I have an applet with a panel that displays the status of external devices and allows the device status to be changed. Here is a brief description.
    The applet has a class that extends JPanel.
    The panel has a set of JButtons that display a color representing the state of the device and text that shows the button action (Open or Close). By default, the JButtons are Green with text = "Open". These are initialized in the init() method of the class that is called only once when it is initialized.
    The panel display class has one method of interest:
    setDeviceStatus() - updates the color and text of the JButtons.
    This is the ONLY ways these components can be changed outside the init() method of the class.
    The method has a System.out.println() statement immediately before any change in text or color.
    There is a simulator applet that is used to send messages via sockets to the display applet.
    Here is what happens.
    1) Applet and panel are initialized correctly.
    2) Simulator applet sends message to update the color and text of a JButton
    3) The message is recieved by the display applet and the setDeviceStatus() method is called.
    4) The print statements before the setText() and setBackground() methods of the Jbuttons are called and new states printed.
    5) Color and text changes on the JButton to Red and Close.
    6) Cursor is moved from JButton and JButton focus is lost.
    7) JButton color and text revert to initial default state of Green and Open.
    There is only ONE call to the setDeviceStatus() method. This call updates the color to RED and text to CLOSE.
    As soon as focus is changed, the display updates to initial values WITHOUT calling the setDeviceStatus() method.
    The behavior is different in JDK 1.4 and 1.6
    JDK1.4) The text and background color change back after focus is lost by either:
    a) Clicking on another window.
    b) Creating an expose event by hiding and redisplaying the applet
    JDK1.6) The text and background color change back after the cursor is moved off of the button.
    CAN ANYONE EXPLAIN HOW TO KEEP THE UPDATED STATUSES????

    Hi Denes,
    I' paste it here ...
    <br><br>
    <table class="t10Button" cellspacing="0" cellpadding="0" border="0" summary=""><br>
    <tr><br>
    <td class="t10L">&lt;a href="#LINK#"&gt;<img src="#IMAGE_PREFIX#themes/theme_10/button_left.gif" alt="" width="4" height="24" /&gt;&lt;/a&gt;</td><br>
    <td class="t10C">&lt;a #BUTTON_ATTRIBUTES# href="#LINK#">#LABEL#&lt;/a&gt;</td><br>
    <td class="t10R">&lt;a href="#LINK#"&gt;<img src="#IMAGE_PREFIX#themes/theme_10/button_right.gif" width="4" height="24" alt="" />&lt;/a&gt;</td><br>
    </tr><br>
    </table><br>
    does this work ...?
    -Carsten
    Message was edited by:
    carstenczarski

  • Newbie :  JSP session problem after reload with IE refresh button.

    Hi,
    I had an issue with JSP reloading using tomcat 4.* and IE.
    I have a jsp1.jsp is opened in two different IE windows(one by one). Once i refreshed using IE refresh button from the first window, its loaded with second windows session details. Its changess whole http request object with second window.
    Am not sure , why its happening ? Could anybody shed light on this ?
    Thanks and Regards
    PV

    Hello,
    No, am not saving any form details . But i noticed session id is changing completely for the first window once i loads frame on the second window.
    javascript:alert(document.cookie) Above scriptlet (IE address bar) returns session id from the second window rather than current window without refreshing, that means, its removed whole request completely or somehow manipulated previous sessions. Can anybody explain this behaviour ?
    Thanks

  • How to execute an applet after a button was clicked in an html page?

    the title says it all..
    I have an applet, and I want it to run only after I click a button, anyone knows how to do that?

    here is htmlpage
    www.somepage.com/index.html
    index.html has a button the hrefs to /yourapplet.html page
    www.sompage.com/appletPage.html

  • Unwanted reloading Applet behavior

    I have a dynamic JTree component on an applet and as and when the user uses the application, nodes are added to or deleted from the JTree. But looks like the Applet behavior is to reload the applet everytime it is revisited or minimized/maximized, and hence the JTree goes back to the initial empty tree state. The JTree's root is initialized in the init() and every time the user adds/deletes a node, the JTree is modified to reflect those node changes. But since the applet is part of a multi-frame HTML, the applet gets reloaded each time and reverts back to its initial state.
    How can I stop the applet from invoking the init(), start() and stop() method each time? Or is the alternative to using a custom JTree Data model, one that reads its data from a Database make more sense? In that way, everytime the applet is reloaded, the JTree reads the latest data from the database and does not go back to initial empty tree state?
    Thanks for all your replies in advance!

    If your applet is reloading, then it will go back to the initial state - invokes init method. To create persistent objects, you may be better off to store the state of the object on your server as a file (object serialization) or a data base. So, that you can reload the previous state even when the init method is invoked - applet reloaded.
    But if you are just maximizing, minimizing, cover/uncover the broswer that has the JApplet with the JTree it should be able to maintain it's current state since only repaint methods are invoked and not init.

  • Where have the reload and stop loading buttons gone?

    The reload button and the stop button do not appear on the toolbar in beta 7. I can reload a tab from the context menu for the tab, not as easy but it can be done. But I can see no way to stop a page load. So how?

    Firefox 4.0 has a combined Reload and Stop button that appears at the far right of the location bar.
    * Open the "View > Toolbars > Customize" window to move them out of the location bar.
    * Swap the two buttons or move them to their previous position at the left of the location bar.
    * If the order is "Reload - Stop" to get a combined "Reload/Stop" button.
    * Swap the order to "Stop - Reload" or separate them otherwise to get two distinct buttons.

  • Opening new applet windows with button

    I'm having a bit of trouble. I have this button when you click it, would open up another window with text in it. That works perfectly. But when I try to add another button for another window, it doesn't go perfectly.
    I took out the useless code to show you the main stuff I'm working with.
    import java.awt.*;
    import java.applet.*;
    public class HorseRacing extends Applet
        CustomFrame gameWindow;
        CustomFrame creditWindow;
        Button openGame, openCredit;
        Image redHorse, yellowHorse, blueHorse, orangeHorse;
        public void init()         
              //Initializes the images
            redHorse = getImage(getCodeBase(), "../classes/horsered.GIF");
            yellowHorse = getImage(getCodeBase(), "../classes/horseyellow.GIF");
            blueHorse = getImage(getCodeBase(), "../classes/horseblue.GIF");
            orangeHorse = getImage(getCodeBase(), "../classes/horseorange.GIF");
              //Instructions window
            gameWindow= new CustomFrame("21 Century Horse Racing - Instructions", redHorse);
              openGame=new Button("View Instructions");
              add(openGame);
              //Credit window
              creditWindow=new CustomFrame2("21 Century Horse Racing - Credits");
              openCredit=new Button("View Credits");
              add(openCredit);
        //  Method Name: action()
        //  Parameters Passed: Event variable evt, Object varible obj
        //  Data Returned: Variable true
        //  Method Purpose: This block responds when the user takes an action
        //                  (such as hitting the return key). It causes the paint
        //                  block to be done again
        public boolean action(Event evt, Object arg)
            Graphics screen=getGraphics();
               boolean visible=gameWindow.isShowing();
            boolean visible2=creditWindow.isShowing();
               if(evt.target instanceof Button)
                 if(visible)
                         gameWindow.hide();
                         openGame.setLabel("View Instructions");
                    else
                         gameWindow.show();
                         openGame.setLabel("Close Instructions");
                    if(visible2)
                         creditWindow.hide();
                         openCredit.setLabel("View Credits");
                    else
                         creditWindow.show();
                         openCredit.setLabel("Close Credits");
            return true;
    //  Name: Sachit Harish
    //  Name of Program: CustomFrame
    //  Date Started: May 15, 2003
    //  Date Finished: 2003
    //  Program Description: This is a racing game where the program will
    //                               generate random odds for the 4 horses. The user
    //                               can then choose their horse and place a bet.
    //                               The user will then see the horses race, and the
    //                               money will be handed out depending on the odds.
    class CustomFrame extends Frame
         CustomFrame(String title,Image redHorse)
              super(title);
              Graphics screen=getGraphics();
              //getClass().getResource("../classes/horsered.GIF").getImage();
              //redHorse=getImage("../classes/horsered.GIF");
              //screen.drawImage(redHorse, 0,0,10,10,this);
         public void init()
              setBackground(Color.gray);
         public void paint(Graphics screen)
              resize(430,280);
              screen.setColor(Color.lightGray);
              screen.fillRect(0,0,500,500);
              screen.setColor(Color.black);
              screen.drawRect(15,40,402,185);
              screen.drawRect(14,39,404,187);
              screen.setColor(Color.gray);
              screen.fillRect(16,41,401,24);
              screen.setColor(Color.black);
              screen.drawString("- - Instructions - -", 160,58);
              screen.drawLine(15,65,417,65);
              screen.drawString("    Once you start clicking on the checkboxes to choose your horse, the", 20,80);
              screen.drawString("odds will be created beside the horses. You can then select the horse",20,95);
              screen.drawString("you want with the checkboxes and in the input box place your bet amount",20,110);
              screen.drawString("Press enter to confirm your bet and click 'Race'.",20,125);
              screen.drawString("    The horses will then race, and once they finish, the winner will be",20,145);
              screen.drawString("displayed. If you didn't choose that horse, you will lose the money you",20,160);
              screen.drawString("bet. If you won, you will be payed out depending on the odds of that",20,175);
              screen.drawString("horse. Your bank will change according to how much money you lost or",20,190);
              screen.drawString("made. Once that is over, new odds will be created and you can play",20,205);
              screen.drawString("again.",20,220);
                 //Image title = getImage(getCodeBase(), "../classes/titlepicture.jpg");
            //screen.drawImage(title, 0,0,430,220,this);         
    //  Name: Sachit Harish
    //  Name of Program: CustomFrame
    //  Date Started: May 15, 2003
    //  Date Finished: 2003
    //  Program Description: This is a racing game where the program will
    //                               generate random odds for the 4 horses. The user
    //                               can then choose their horse and place a bet.
    //                               The user will then see the horses race, and the
    //                               money will be handed out depending on the odds.
    class CustomFrame2 extends Frame
         CustomFrame2(String title)
              super(title);
              Graphics screen=getGraphics();
              //getClass().getResource("../classes/horsered.GIF").getImage();
              //redHorse=getImage("../classes/horsered.GIF");
              //screen.drawImage(redHorse, 0,0,10,10,this);
         public void init()
              setBackground(Color.gray);
         public void paint(Graphics screen)
              resize(430,280);
              screen.setColor(Color.lightGray);
              screen.fillRect(0,0,500,500);
              screen.setColor(Color.black);
              screen.drawRect(15,40,402,185);
              screen.drawRect(14,39,404,187);
              screen.setColor(Color.gray);
              screen.fillRect(16,41,401,24);
              screen.setColor(Color.black);
              screen.drawString("- - Credits - -", 160,58);
              screen.drawLine(15,65,417,65);
              screen.drawString("    CREDITS", 20,80);
                 //Image title = getImage(getCodeBase(), "../classes/titlepicture.jpg");
            //screen.drawImage(title, 0,0,430,220,this);         
    }If I take away everything associated with the creditWindow, it will work. But when I add that in, I get problems.
    Also, I let in those redHorse, yellowHorse, blueHorse, and orangeHorse images because thats another problem I'm having - to get an image to work in one of those new windows.
    -s64

    What happens if you change to a modern action listener?

  • How to load new sets of parameter to an applet without reloading applet

    hello,
    I am making an application wherein the there are 2 frames the left and the right. the left frames contains links and the right frame contains an applet that displays the images of the documents.
    So for example:
    DOC00001 has Image 1 and Image 2
    DOC00002 has Image 3 and Image 4
    At first applet will be loaded, and the loading applet (Splash screen) appears then displays Image 1 and Image 2. But when I click DOC00002, it is reloaded again(Splash Screen) before displaying image 3 and 4.
    Is there a way wherein I just call a function from the applet so that I dont need to reload again the applet and just change its display?
    hoping for help. thank you

    Hi,
    You can make an executable jar file such that when you double click on that it starts running. Just follow the steps.
    1. Open a notepad and write the following
    Main-Class: XXXXXXXX
    XXXXXXX means Your Main Class name. Don't forget to press Enter after you write your class name.
    2. Save the file as Mani.mf
    3. In the commant prompt ( your directory ) type following lines.
    jar cmf Mani.mf Demo.jar *.*
    4. This will make a jar file which is executable jar file
    Hope this will help you.
    Deepak

Maybe you are looking for

  • Multiple oracle home installation

    I am going to install oracle 11g2 on hpux server. The server already has 10g on it and the plan is to run both for sometimes. Unfortunately, IUnfortunately, I don't have prior experience installing multi-homed oracle software and I need help on how t

  • Movie Rental Period

    Can someone please help me understand Apple's seemingly draconian policy of allowing me only 24 hours to watch a rented movie? Why is it that the movie can sit on my iPod for 30 days unwatched, but as soon as I begin watching it, it is going to disap

  • Trying to move my iTunes Music and other media from the main drive on my pc to an external hard drive but iTunes is not recognizing the new file location?  Ideas?

    Trying to move my iTunes Music and other media from the main drive on my pc to an external hard drive but iTunes is not recognizing the new file location?  Ideas?

  • I cant receive mail on any device

    all of a sudden my email address wont receive any emails, when i try to send email from another email address i get a delivery notification sayinf delivery has failed and the reason is "over quota"

  • Library Item Conflict

    Hi. I'd appreciate any help people can offer regarding this problem. I am creating some animations using Flash 8. Some work just fine. Others give me the following message when I try to add a new movie clip: One or more library items exists in docume