Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Repeating an Applet

Status
Not open for further replies.

JJOHNS

MIS
Sep 12, 2001
171
US
I've written an Applet that takes a string as input (from JOptionPane) and then tells the user whether it's a palindrome or not. Works great, but I have a problem.

I need the Applet to restart after giving the answer. In other words, I enter a string. Then I want the applet to say it is or isn't a palindrome and then start over. I want that to continue until I type "Q" to quit.

I first wrote this as an application and it works fine, but I need it to be an applet.

two things I've tried that didn't work were to recall the init() method after printing the "That's a palindrome." statement. That would give me the JOptionPane box again, but then stop.

The next thing I tried was to create a starter() method. I called it from init() and after the answer statements. I got the exact same result.

Any ideas?

 
Maybe reloading your applet might solve your problem.
If you are running your applet in a browser,instead of calling init method use this syntax
{
....
getAppletContext().showDocument(new java.net.URL("what is url address?Directly type it","_self");
this.stop();
.....
} Salih Sipahi
Software Engineer.
City of Istanbul Turkey
openyourmind77@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top