Applet to another applet

Hi
How do I change my applet interface to another on some event (say, initially I show the frame to take user data and on its authenticity I need to give him another interface to enter some other data).
Thanx

public class Starter extends javax.swing.JApplet {
     public javax.swing.JPanel jp;
     public Menu menu;
public void init(){
jp = new javax.swing.JPanel();
          jp.setLayout(new java.awt.BorderLayout());
          getContentPane().setLayout(new java.awt.BorderLayout());
          menu = new Menu(this);
          jp.setDoubleBuffered(true);
          jp.add(menu.getContentPane());
          getContentPane().add(jp, "Center");
Once in menu you choose an option that will change the menu screen to another by doing this:
parent.jp.remove(parent.menu.getContentPane());
          DifferentFrame fb = new DifferentFrame(this);
          parent.jp.add(fb.getContentPane(), "Center");
          fb.setVisible(true);
          fb.hide();
          parent.jp.repaint();
          parent.repaint();
          repaint();
Note the above is dealing with JFrames(DifferentFrame and Menu are JFrames), with a JPanel or other components you do not need to use the getContentPane() method.

Similar Messages

  • Open/Call an applet From another applet

    Hi everybody,
    I want to open/call an applet from another
    applet via a button. when the user press
    the button, next applet load.
    Appreciate your response.
    null

    try {
    URL secondpage="second appleturl.html");
    getAppletContext().showDocument(secondpage,"seconf applet_frame");
    }catch (java.net.MalformedURLExceptione){*Write your error messages here*/}
    Regards
    Sonlam
    null

  • Send APDU form an applet to another applet

    Hi,
    I try to send an APDU from an applet to another applet. Both runs on the same Java Card.
    With a jar-file on Eclipse:
    I select the cardreader,
    terminal = (CardTerminal) terminalList.get(1);establish a connection with the card,
    Card card = terminal.connect("T=1");
    channel = card.getBasicChannel();and send the CommandAPDU
    ResponseAPDU r = channel.transmit(new CommandAPDU(data));Has so. an idea how to realize with an applet?

    There are three options how two applets can exchange data:
    1. Shareable Interface Object, as mentioned. Mandated if applets are in different packages.
    2. Same package. If applets are in the same package, all public fields and methods are accessible.
    3. Library. A package without any class extending base class Applet from javacard.framework is called a library. The applet firewall is not active in this case. All applets can access public fields and methods.

  • Accessing an applet from another applet

    Hi,
    I created a web page with a bunch of applets running on it, and I need to comunicate them. Is it possible to access the public methods and variables of one applet from another applet ? How do I do it ?

    I recently read an article that described how to access other applets in the same page, but I didn't pay much attention to it because I don't write applets. However, a quick look at the API documentation for the java.applet package shows this:
    "AppletContext: This interface corresponds to an applet's environment: the document containing the applet and the other applets in the same document."
    So I would try to get an AppletContext and see what could be done with it.

  • Calling one applet to another applet

    Hi,
    How to call one applet program to another applet program.
    thanks in advance

    ManiForum wrote:
    ..How to call one applet program to another applet program.3 tips
    - How to Google.
    - How to ask [smart questions|http://catb.org/~esr/faqs/smart-questions.html].
    - How to use [question marks|http://www.google.com/search?q=question+marks] to denote a question.
    ..thanks in advanceNo wuckin' furries.

  • Load applet within another applet?

    Let's say I have two applets, A1, and A2. I'd like to load A1 on my HTML page, and I'd like A1 to load A2 within itself (i.e. not load it as another separate applet on the HTML page).
    Basically, A2 takes some parameters I would like to pass to it through A1, so I'd like to know if this is possible.
    Thanks for any help!
    James

    Totally possible. You just have to provide it an applet context
    see http://java.sun.com/j2se/1.4.2/docs/api/java/applet/AppletContext.html

  • Java applet calling another applet on the Javacard

    Hi, I am new to JC.
    I have some Java classes which I do not want others to extend. Hence, to hide these classes, I have created a set of helper classes that will provide services to these "hidden" Java classes to other calling applets, much like the way I do in J2SE. Something like a wrapper class.
    The problem is, I am not sure if other applet classes can call this new helper class or not? and I am also not sure how this can be done. Can someone advise? Thanks in advance.

    I'm not sure what this has to do with JavaCards.
    Sounds like a simple Facade Design Pattern. Also your classes are "hidden" when you make them package protected or package private. Read J2SE packages and you'll see what I mean.
    If you are referring to JavaCard, by design each package is it's own context therefore, there's a context firewall to protect it's objects and data. A shareable Interface object must be implemented to allow access.

  • Using an applet to call another applet

    Hi,
    I know that some of you may have heard this question many times before from other people, however this is an act of desperation as I have tried searching everywhere in vain for the solution.
    How do you call an applet from another applet? I cannot seem to find a solution that works. I have created a simple game using Java applets but I am trying to create a title screen. Since the graphics method calls itself repeatedly, I didn't bother putting the method that drew the main screen into the paint (Graphics g) method. So I have finally decided upon creating a seperate simple applet that would only show the main screen, and when a button is pressed, the game will be played. I have everything except for the "calling an applet" part. So how do I call an applet from another applet? What is the most simple / efficient way that someone with limited technology and understanding of applets can understand?
    Thanks a bunch.

    Yeah well this was also a bit tough for me.. but well mate.. finally cracked it.. ok here is the explanation and eg:
    Suppose there are 2 applets. parent and child.. and respectively they are embeded into 2 seperate html files :
    i) parent.html
    ii) child.html
    The task on our hand is .. when there is an event in the parent.. for eg a mouse-click or a button press.. it loads the child applet automatically.
    I will demonstrate this with this example:.. here is an applet .. parent which has a button.. upon button press. it loads the child applet.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.applet.*;
    public class parent extends JApplet implements ActionListener
         JPanel p=new JPanel();
         JButton b=new JButton("Submit");
         public void init()
              b.addActionListener(this);
              p.add(b);
              getContentPane().add(p);
                   parent p=new parent();
         public void actionPerformed(ActionEvent ae)
              if (ae.getSource()==b)
              {   //pay attention here
                      AppletContext ac=getAppletContext();
                    URL url=getCodeBase();
                    try
                                 ac.showDocument(new URL(url+"child.html"));
                    catch (MalformedURLException e)
                   showStatus("URL not found");
    }Well.. i am sure you can code the html :)

  • Can I call applet in other applet???

    1.Just like a call a frame in new window.....can i call a frame in the same window.
    2.Can i call an another applet in the same window from a running applet.if yes how can i send any variables to it??

    Your first question is not really clear to me, but the second I got. You can have an applet call another applet, you need to use getApplet or getApplets (which return Applet and Applet[] respectively). If you use getApplet you need to name your applets, while getApplets just returns every single applet on the page.
    Then, when you have Applet myOtherApplet = getApplet("Applet2");
    You can do myOtherApplet.method(int parm1, String parm2);
    Applets are named in the html file, don't remember the correct syntax right now.

  • What are the methods called while navigating from one applet to another one

    Hi All,
    Could any one brief me about "When you navigate from one applet to another what are the methods called ?".
    Thanks in advance.
    Best Regards,
    N.Madhusudhanan.

    http://forum.java.sun.com/thread.jsp?forum=421&thread=426771&tstart=0&trange=100

  • Is it possible to transfer data from one applet to another?

    I have designed a calendar. Using the calendar,i have selected some dates. Is it possible to send the selected dates to another applet? If yes, please send the code to transmit data..

    I have designed a calendar. Using the calendar,i have selected some dates. Is it possible to send the selected dates to another applet? If yes, please send the code to transmit data..

  • How to communicate with another applet in different frame?

    Hello,evryone
    How to communicate with another applet in different frame?
    Can you give some advices?
    thank you!
    zhongboqing

    i faced this problem one year ago.It would be something like that:
    first you have to get the applet context 'getAppletContext()' (which is the current frame).
    Then get parent of that context 'getParent()' (which is the browser context).
    Then u can access the desired frame by its name. Finally you can access the desired applet located within this frame by

  • Sharing an applet with another dosn't function

    Hi all,
    i have a problem that i share an applet with another, but it dosn't function:
    i have two applet: epurse & bank   (bank is the master)
    for that i creat a class "bankInterface" that's inherit from sharable:
    package pack4;
    import javacard.framework.APDU;
    import javacard.framework.Shareable;
    public interface bankInterface extends Shareable {
      public void debit(APDU apdu);
    bank's declaration:
    public class bank extends Applet implements bankInterface {
    public Shareable getShareableInterfaceObject (AID clientAID, byte param){
      return ((bankInterface)this);  //or return this;
    public  void deselect(){
          pin.reset();
      public boolean select() {
           return super.select();
      public static void install(byte bArray[], short bOffset, byte bLength) throws ISOException {
           new bank();
    private bank() {
      register();
    public void process(APDU apdu) throws ISOException {
    public void debit(APDU apdu){
    //empty juste for testing
    }// end class 'bank'
    epurse's declaration:
    package pack4;
    import ...
    public class epurse extends Applet {
    byte[] AIDServer=new byte[]{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x00, 0x00};
    public bankInterface sio;
    private epurse() {
      sio=(bankInterface) JCSystem.getAppletShareableInterfaceObject(JCSystem.lookupAID(AIDServer, (short)0, (byte)AIDServer.length), (byte)0);
    //methods: install, select, deselect
    public void process(APDU apdu) throws ISOException {
    byte[] apduBuffer=apdu.getBuffer()
    if(apduBuffer[ISO7816.OFFSET_CLA] == (byte)0x80){
      switch(apduBuffer[ISO7816.OFFSET_INS]){
      case (byte)0x34:
      credit(apdu);break;
    else{ ...}
    }//end process
    private void credit(APDU apdu){
    apdu.setIncomingAndReceive();
    sio.debit(apdu); // if this line is commented, i get the sw1:90 sw2: 00; else i get sw1: 6f sw2: 00 (wrong length)
    }// end class epurse
    i don't know where's the problem?

    Hi,
    If you go through the SIO concepts of JavaCard its mentioned that when "getAppletShareableInterfaceObject" is called from the client the JCRE will call "getShareableInterfaceObject" method of server with clientAID but where as you are requesting for SIO in install method before registration where the clientAID doesnt exists so the call will fail and return "null" and further references to SIO object will fail to perform expected operations.
    So put request for SIO after registration of your client applet.
    BR,
    PPT

  • Calling one applet from another passing database connection

    We are trying to establish if it is possible to start an applet that connects to a database and use that as a 'menu'. From there we would call other applets. Is there a way to pass along the database connection from one applet to another. Any help is greatly appreciated.
    null

    Here' s a sample program in the Java Tutorial that messages between applets.
    http://java.sun.com/docs/books/tutorial/applet/appletsonly/iac.html

  • Hope u will send me the details of calling an applet from another

    hai to all
    i am trying to do an applet ,and it corrct in jdev ide,but trying to run in explorer
    i cant connect the database,
    but in applet viewer also i cant call another
    applet throught a button or any thing
    i hope u will send me details
    and thanks a lot to Joe silva
    thanks in advance
    anas
    null

    I've not done it myself but I think you must have a name for the second applet specified in the html tag. That is how the first applet will be able to identify the second applet.
    maybe..
    <APPLET CODE="FirstApplet.class"></APPLET>
    <APPLET CODE="SecondApplet.class" NAME="ReceiverName"></APPLET>
    then in your java code
    SecondApplet app = (SecondApplet) getAppletContext().getApplet("ReceiverName");
    if (app != null)
    <execute code>
    But I've not done it, so its only a suggestion...

Maybe you are looking for

  • Simple but reliable small office setup

    Hi group, I need some advice on setting up a simple but reliable small office wireless network. Up until now, we had a consumer AP combined with wired connections. However, we're moving to a new office where it's difficult to implement a wired networ

  • Switching off location services disables cell service?

    Is this right? If I switch off location services, I cannot send or receive cell phone calls. Basically switching off location services is the equivalent of putting my phone in airplane mode? I'm using an iPhone 5 with the current iOS. Thanks.

  • Add insert/overwrite audio like in PP

    As Audition gets more features hod-rodded from PP, why not add the insert/overwrite as well? I often need to insert audio into a project, which means pushing all the tracks in the timeline back to make way for it. This is exactly how PP does it when

  • Cheque / Check Printing

    Checks/Cheques can be printed through the 1.  Checks for Payment PLD - a warning message to confirm Check numbering occurs / check number is updated in SAP B1 2.  Outgoing Payment PLD - Check numbering is not updated when using this method.  The phys

  • Building A Currency Converter Web Portlet

    Hi, I've done a complete install from a Redhat 6.2 CD onto a sinle processor machine, apparently if I switch the kernel to SMP it may help with problems I'm having with my OAS 4.0.8.1 WRKSF going down, can this easily be done or do I have to deinstal