Communication between two JApplets on the same web page

Hi Freinds
I have a JSP page containing two applets as follows :-
<jsp:plugin type="applet" code="TreePageJavaClass.class" codebase="/MYOA" width="200" height="300" name="Applet1">
</jsp:plugin>
<jsp:plugin type="applet" code="TreePageJavaClass2.class" codebase="/MYOA" name="Applet2" width="200" height="300">
</jsp:plugin>
First applet extends JApplet class and has a tree constructed using swing.
Second applet extends Applet class.
Now I want to call a method in second applet on selecting a particular tree node on first applet. I can call method on second applet from first applet when both extends Applet class (not JApplet)
So please tell me what's the problem here and how it can be solved.
Thanks

First Applet :-
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.tree.*;
import java.applet.*;
public class TreePageJavaClass extends JApplet {
JTree tree;
JTextField jtf;
Container contentPane;
public void init() {
contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
DefaultMutableTreeNode top = new DefaultMutableTreeNode("MakeYourOwnAds");
DefaultMutableTreeNode a = new DefaultMutableTreeNode("User1");
top.add(a);
DefaultMutableTreeNode a1 = new DefaultMutableTreeNode(getParameter("param1"));
a.add(a1);
DefaultMutableTreeNode a2 = new DefaultMutableTreeNode(getParameter("param2"));
a.add(a2);
DefaultMutableTreeNode a3 = new DefaultMutableTreeNode(getParameter("param3"));
a.add(a3);
DefaultMutableTreeNode a4 = new DefaultMutableTreeNode(getParameter("param4"));
a.add(a4);
tree = new JTree(top);
int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h =ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp = new JScrollPane(tree, v, h);
contentPane.add(jsp, BorderLayout.CENTER);
jtf = new JTextField("", 20);
contentPane.add(jtf, BorderLayout.SOUTH);
// Anonymous inner class to handle mouse clicks
tree.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent me) {doMouseClicked(me);
void doMouseClicked(MouseEvent me)
TreePath tp = tree.getPathForLocation(me.getX(), me.getY());
TreePageJavaClass2 app = (TreePageJavaClass2)getAppletContext().getApplet("Applet2");
if(tp != null)
     if (tp.toString().equals("[MakeYourOwnAds, User1, Ajay]"))
     jtf.setText(tp.toString());
          if (app == null)
          app.setData("null");
          else
               app.setData("Ajay");
     else
          jtf.setText(tp.toString());
else
jtf.setText("");
Second Applet :-
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class TreePageJavaClass2 extends Applet
private Label msg;
public void init()
setLayout(new BorderLayout());
setBackground(Color.LIGHT_GRAY);
msg = new Label("Applet2 is running...", Label.CENTER);
add(BorderLayout.CENTER, msg);
public void setData(String message)
msg.setText("Selected Node is " + message);
Hope you guys will help me.
Thanks

Similar Messages

  • Communication between two network with the same IP segment

    Good Moorning:
    How can establish communication between the production environment and test environment with the same IP segment using switch Cisco Nexus 5548?

    Carlos
    The short answer is you can't as far as i know. You need to do NAT to able to do this and i don't think the Nexus switches support NAT.
    You need a device that can NAT both address ranges. If prod is always the one that initiates the connection then you need static NAT translations for the test machines and you can dynamicaly NAT prod addresses as they go into the test env.
    But if both prod and test can initiate connections then you need to have static NAT translations for both sides.
    We used a pix firewall for this when we connected our prod and test environments. A firewall is a good choice because you can make the test enviornment the outside interface where all traffic is denied by default. You do not want test affecting prod.
    Jon

  • How do I share one itunes account between two users on the same computer

    How do I share one itunes account between two users on the same computer without taking up twice as much space on my hard drive?

    You would need to move the itunes folder to a location that both users have permissions to access such as the Shared folder or any folder on the root level of the macintosh HD.
    You can find instructions here http://support.apple.com/kb/HT1203 This method allows you to share the content without sharing the same library.

  • Hello there - how can I share my iTunes library between two users on the same computer? I put the library in a shared folder between both and have selected this library on both as well, but when I update iTunes with music etc it only appears on one?

    Hello there - how can I share my iTunes library between two users on the same computer? I put the library in a shared folder between both and have selected this library on both as well, but when I update iTunes with music etc it only appears on one?

    Thank you Joe - I tried this but it's only showing a teensy amount of music - the stuff on the second users account as opposed to the giagntic library on the 'main' account. I actually went to a Genius Bar and they said that apple doesn't really want you to share music between accounts - parents don't want to hear their kids music etc. Which seemed strange, but it might be the case sadly   Thanks anyway!

  • Share a library between two users on the same mac?

    It is possible to share a library between two users on the same mac?

    It's doable. As it's been pointed out Aperture has no provisions for file locking so you can't have two users accessing the library at the same time. This includes having one user having the library open only for browsing. Aperture doesn't have a +Read Only+ mode, when it opens the library, even if you make no changes to any images, the library will be written to.
    This also means you can't have one user open the library and then stop using Aperture but still have the library open and then have another copy of Aperture open on the library.
    Of course if you have two copies of Aperture running even they are on different libraries you'll be in violation of the license and you'll have bigger problems to worry about then a toasted library.

  • Can i share music and photos between two users on the same machine?

    How can I share my music and photos between two users on the same machine?

    Thank you Joe - I tried this but it's only showing a teensy amount of music - the stuff on the second users account as opposed to the giagntic library on the 'main' account. I actually went to a Genius Bar and they said that apple doesn't really want you to share music between accounts - parents don't want to hear their kids music etc. Which seemed strange, but it might be the case sadly   Thanks anyway!

  • TS2972 is it possible to use home sharing between two users on the same computer?

    My wife and I have itunes accounts and want to be able to share music we have each bought on our accounts. We have tried setting up the home sharing on our PC but it doesn't show up on the screen. Can anyone please help?

    "Is it possible to use home sharing between two users on the same computer?"
    No. Home sharing is used to connect two running instances of iTunes across a network. When you switch users on the computer all applications running on the other profile are suspended.
    You can however share your respective media folders so that they are visible in either profile and then copy over any content that you want, or you could create a single joint library which you use when either user is logged in.
    tt2

  • Distinguishing between two instances of the same portlet

    Hi Experts,
    Is there a way to distinguish between two instance of the same portlet in different browser windows?
    I'm looking for something like URL parameter passing, but just for portlets.
    The problem is, I want a way to pass a parameter between views in a portlet, but in such a way that if another browser window is opened and navigated to that portlet page, the parameter won't be the same. Perhaps I can explain better with this example:
    Page A has a portlet on it which has a textbox and 2 buttons - the first button stores the value in the textbox in the PortletRequest (or PortletURL) and if you click the second button the portlet navigates to a different view which displays the value. If I navigate with a second browser window to Page A, however, and only click the navigate button, that value which was stored by the first instance of the portlet will still be shown. I want them to be independent, I don't want changes in the one's PortletRequest to reflect in the other one's PortletRequest.
    Any ideas?
    Thanks,
    JP

    Why not use two instances of the same portlet, i.e. create two channels of the same portlet.
    The behave the same, have the same application logic, so all you need is to transfer informations between the two portlets.If you want this within user space use the portlet session, otherwise access the http session context /application context and store the data there.
    The behavior would be controlled by the portlet preferences, so channel a (instance 1) would be configured to run as controller and channel b (instance 2) would be configured as receiver.

  • Sync a folder between two users on the same computer.

    I would like to sync a folder between two users on the same computer so that they are always the same when I access them from either user.

    then place this folder somewhere where both users have access to like in /Users/Shared. then there is only one folder to deal with and you don't need to sync anything.

  • How do I share music between two accounts on the same i-mac

    How do I share music between two accounts on the same i-mac

    iTunes: How to share music between different accounts on a single computer - http://support.apple.com/kb/HT1203 - relocating iTunes' media folder to a shared area but leaving separate library files - extra tip at https://discussions.apple.com/message/17331189

  • MacBook Air intermittently has issues connecting to websites when wireless shows connected to the internet. The pages show that I am offline, but I can ping Google DNS. Windows PC, iPhone and Android phone have no issue displaying the same web pages.

    MacBook Air intermittently has issues connecting to websites when wireless shows connected to the internet. The pages show that I am offline, but I can ping Google DNS. Windows PC, iPhone and Android phone have no issue displaying the same web pages.How do I solve this issue?

    Go step by step and test.
    1. Power off the router. Unplug it from the wall. Wait a while.
        Plug it back to the wall. Power the router on. Wait until all the lights are lit properly. It will take a while.
        Restart the computer.
        Start up in Safe Mode.
        http://support.apple.com/kb/PH14204
    2. Empty Caches
        Safari > Preference > Advanced
        Checkmark the box for "Show Develop menu in menu bar".
        Develop menu will appear in the Safari menu bar.
        Click Develop and select "Empty Caches" from the dropdown.
    3. Deselect Proxies if selected.
        System Preference > Network > Advanced  > Proxies Tab
        Under "Select Protocol", uncheck any box if selected.
        Click "OK" then  "Apply”.

  • TS2972 I have multiple libraries on the "same computer" with two different desktops, can't I share between two libraries on the same computer?

    I'm trying to use home sharing to share content between libraries so some of the combined content in a given library, can be synced to an ipad.   Instad of having mulitple computers, i have multiple libraries on the same computer using two desktops.  How do I share within the same computer?

    iTunes must be running for home sharing to work.  There is no way to have home sharing running simultaniously for two users on the same computer.
    Simply add the media files using File > Add File/Folder option in iTunes.

  • When communicating between PDB's in the same CDB, are dblinks faster

    Is it faster to communicate between PDB's in the same CDB using dblinks or will it still continue to do a loop back within the network in order to communicate with the PDB? If anyone has any insight please let me know. Thanks all

    12cdb wrote:
    No, I did not mean that.
    Let me rephrase - Both PDBs are under same Instance (CDB) so the communication over db link between those 2 PDBs will be faster.
    Hope that is clear now.
    Pradeep
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.
    Can you prove above is really true?

  • DBlink between two schema on the same database.

    Hello,
    I am facing a troublesome situation here regarding a database link. Usually I create my db links between two databases hosted on two different servers but in this current situation, am in short of machines. The database informations are contained in two different schema that were suppoded to be imported on two different databases(servers). As only one machine is available,I would like to know given the situation, whether I can create two schemas on the same database and link both schema using a database link. Is it possible? If yes, how do I achieve that?
    Thanks in advance.

    adomi wrote:
    Hello,
    I am facing a troublesome situation here regarding a database link. Usually I create my db links between two databases hosted on two different servers but in this current situation, am in short of machines. The database informations are contained in two different schema that were suppoded to be imported on two different databases(servers). As only one machine is available,I would like to know given the situation, whether I can create two schemas on the same database and link both schema using a database link. Is it possible? If yes, how do I achieve that?
    Thanks in advance.Cann't understand you. If you transfer data between two databases, then use database link. If you use only one database, then you don't need to use database link. Please elaborate more

  • How can I share a folder between two users on the same mac?

    Hi all,
    I would like to share a folder between multiple users on the same macbook without having to transfer the folder to the Public/Shared folder.
    Is there not a way, using the the folders shared permissions, to allow shared folders from one user to be visible and usable by another user on the same mac without having to move the folder to a designated shared location?
    Regards,
    Caleb

    jrwood116 wrote:
    Thanks, but do you have to do that every time you share a folder?
    No, you just need to do it once and that's it. Anything that is in the Shared folder is accessible by all user accounts within the same Mac.
    jrwood116 wrote:
    I've read numerous 'how to share a folder' blogs and they just say it's as simple as clicking 'share' and allowing specific users to access it...none have mentioned this (not saying your advice is wrong at all, just don't get why no-one else has mentioned what appears to be a key step!)
    Can you give me an example of such a blog. I suspect you may have mis-understood what they were saying but if you can provide a link, I'll look at it.

Maybe you are looking for