• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Applet Calling another applet

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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....
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
chinna velagala
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks..... thats a good idea......can you provide me with a sample example.... please... it would be great.....
 
chinna velagala
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
okkkk.... thanks....... so cool about you......can you please provide me with a sample example....???
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a look here: http://java.sun.com/docs/books/tutorial/uiswing/layout/card.html
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic