Results 1 to 5 of 5
- 12-19-2010, 09:02 PM #1
Member
- Join Date
- Nov 2010
- Posts
- 22
- Rep Power
- 0
JApplet retains information after leaving page
Hello I have a JApplet on a webpage. Everything works fine the first time I go to it in a session. If I go to a different page, and come back to it, there are issues. Even if I refresh the page, I have issues. They do not go away until I close the whole browser and reopen.
The issue I am having is the last thing that was painted on the screen before leavign the page show up again next time you go to the page. I want to start fresh every time I go to the page again.
Thanks!
- 12-20-2010, 12:15 AM #2
Member
- Join Date
- Dec 2010
- Posts
- 17
- Rep Power
- 0
Hello, The convention is to create threads in init(), start them in start(), and stop them in stop()...The start and stop methods are automatically called as you leave/enter the page.
- 12-20-2010, 12:35 AM #3
Member
- Join Date
- Nov 2010
- Posts
- 22
- Rep Power
- 0
Interesting. Do you have an example of this that I could look at?
- 12-20-2010, 03:30 AM #4
Member
- Join Date
- Dec 2010
- Posts
- 17
- Rep Power
- 0
Java Code:public class AppletName extends JApplet implements Runnable { Thread myThread= null; public void start() { if ( myThread== null ) { myThread= new Thread( this ); myThread.start(); } } public void stop() { if ( myThread!= null && myThread.isAlive() ) myThread.stop(); myThread= null; } public void run() { while ( myThread!= null ) { repaint(); try { Thread.sleep(20); } catch ( InterruptedException e ) { // do nothing } } } }
If you never used threads before I suggest you read up on them.Last edited by andyman99008; 12-20-2010 at 03:37 AM. Reason: code tags
- 12-20-2010, 12:05 PM #5
Member
- Join Date
- Nov 2010
- Posts
- 22
- Rep Power
- 0
Similar Threads
-
Java Popup .hide() method is leaving a grey box in the shape of the JTextArea I use.
By shawleigh17 in forum AWT / SwingReplies: 3Last Post: 03-03-2011, 04:59 PM -
Programmatically configuring Log4J Logger while leaving config alone
By Hichhiker in forum Advanced JavaReplies: 0Last Post: 05-19-2010, 09:44 PM -
JApplet on MAC
By ld_pvl in forum Java AppletsReplies: 0Last Post: 08-23-2009, 01:40 PM -
how to clear the session when leaving a page.
By shivakumari in forum Java ServletReplies: 3Last Post: 03-25-2009, 06:25 AM -
JFrame to JApplet or JApplet to JApplet
By ramesh.8189 in forum AWT / SwingReplies: 13Last Post: 02-08-2009, 06:14 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks