Results 1 to 6 of 6
  1. #1
    laxtrappa is offline Member
    Join Date
    Mar 2012
    Posts
    13
    Rep Power
    0

    Default applets states in browsers

    to explain this, it's easiest to let you view my very first java applet, a simple adventure game engine:

    http://213.21.66.155/Adventure/bin/bq.html

    now for my problem. it does not seem to be possible to restart the applet by reloading the url.
    the applet remembers it's previous state. the only way is to shut down all browser instances
    and access the url again. how can i make the applet reset?

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,271
    Rep Power
    25

    Default Re: applets states in browsers

    What applet methods does the browser call when you reload the URL?
    Add some printlns to the applet's methods to see.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    laxtrappa is offline Member
    Join Date
    Mar 2012
    Posts
    13
    Rep Power
    0

    Default Re: applets states in browsers

    i just use the init() method. i know of start(),stop() and destroy() and when then are being called but never really understood
    what to put in them :P
    if you've got the energy you can actually see whts going on as the source is located on the web server as well:
    http://213.21.66.155/Adventure/src/c...entureGUI.java

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,271
    Rep Power
    25

    Default Re: applets states in browsers

    Create the methods and add the printlns to see which are called.
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    laxtrappa is offline Member
    Join Date
    Mar 2012
    Posts
    13
    Rep Power
    0

    Default Re: applets states in browsers

    upon first url request, init() and start() are run. when i reload stop(), destroy(), init() and start() are run.
    what i dont get is if init() is run on reload, how come the applet isnt restarted?

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,271
    Rep Power
    25

    Default Re: applets states in browsers

    You should read how browsers call applet methods:
    Lesson: Java Applets (The Java™ Tutorials > Deployment)

    applet isnt restarted
    Can you explain what you mean here?

    Add a constructor to the applet with a println to show when it is called.

    init() is run on reload
    Does your init() method completely reset everything?
    Last edited by Norm; 03-24-2012 at 05:27 PM.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. JButton States Set to Pictures From Image Editor
    By wired-in=p in forum New To Java
    Replies: 10
    Last Post: 08-21-2011, 04:33 AM
  2. Refresh browsers
    By xnotte in forum Advanced Java
    Replies: 2
    Last Post: 02-19-2011, 06:41 AM
  3. help with browsers
    By paulpa66 in forum New To Java
    Replies: 1
    Last Post: 08-07-2010, 01:41 PM
  4. Applets painting outside borders in web browsers
    By sirdori in forum New To Java
    Replies: 2
    Last Post: 11-20-2008, 06:14 PM
  5. First Applet not running on browsers
    By Centinela66 in forum Java Applets
    Replies: 11
    Last Post: 10-09-2008, 01:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •