wood burning stoves 2.0*
The moose likes Applets and the fly likes Applet Calling another applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet Calling another applet" Watch "Applet Calling another applet" New topic
Author

Applet Calling another applet

chinna velagala
Greenhorn

Joined: Apr 02, 2008
Posts: 8
hey can anybody provide me the help in this matter.....

i want to load second applet from first applet when i click a button in first applet......

please i require it urgently....
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41182
    
  45
Welcome to JavaRanch.

What does "load the second applet" mean? Is this applet part of the same web page as the first one? In that case it will be loaded as soon as the page gets rendered, together with the first applet.

If not, tell us in detail what you're trying to do.


Ping & DNS - my free Android networking tools app
chinna velagala
Greenhorn

Joined: Apr 02, 2008
Posts: 8
i created an applet which consist of 1) a question 2) 5 options and 3) a button
this is my first applet

so when i click the button it should load the second applet.....

my second applet consist same components as the first applet..........

This is similar to any online exam question paper........we will get a single ques at a time.... when we mark the answer and click the next button we will get the next question.......

i created the required applets but now connectivity is needed between them..

see the pic in the link i provided here..............

http://qshare.com/get/169486/untitled.JPG.html
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41182
    
  45
You can't easily switch from running one applet to running a different one without losing all data in the applet, neither in appletviewer nor in the real HTML page.

But it sounds as if you don't really need two (or more) applets, since all you want to do is display several "pages" in an applet. This can be achieved by using a java.awt.CardLayout for the applet. It allows you to display several "cards" - in effect pages containing GUI elements, and lets you switch programmatically between them.
chinna velagala
Greenhorn

Joined: Apr 02, 2008
Posts: 8
Thanks..... thats a good idea......can you provide me with a sample example.... please... it would be great.....
chinna velagala
Greenhorn

Joined: Apr 02, 2008
Posts: 8
hey if you are thinking that i use panels in my applet.....then you are wrong...........As i am preparing an question paper consisting of 20 questions......the exam taker should not go to previous questions once answered.......so i won't use panels.....
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41182
    
  45
the exam taker should not go to previous questions once answered .......so i won't use panels

Whether you want to allow going back has nothing to do with using panels. As I said in my previous post, using CardLayout you can determine programmatically which "card" to show next. If you don't want a user to go back, just program it that way. So I would urge you to reconsider the "i won't use panels" stance. Adhering to it would prevent you from using a simple solution to this problem.
[ April 03, 2008: Message edited by: Ulf Dittmer ]
chinna velagala
Greenhorn

Joined: Apr 02, 2008
Posts: 8
okkkk.... thanks....... so cool about you......can you please provide me with a sample example....???
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41182
    
  45
Take a look here: http://java.sun.com/docs/books/tutorial/uiswing/layout/card.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applet Calling another applet
 
Similar Threads
Refresh problem in applet
object of one applet accessed by object of another applet
The world's worst websites
Applet to Applet communication
How to dispose an Applet