Handling multiple applets inside applet window

Hi all,
Does anyone know of a tutorial for handling multiple applets inside an applet window ?? Any suggestions would be greatly appreciated.
Regards,

Hello vhhuynh,
Did you ever get a solution to your question: 'tutorial for handling multiple applets inside an applet window'?
I have the same situation...
thanks, msp@duke

Similar Messages

  • Embedding Applet in native Windows Application

    Hi!
    I need to integrate applet into my windows application (MSVC).
    The problem is displaying applet(s) within the application's main window (just like in browser).
    Is there a way to do it? Using WebBrowser (IE) ActiveX component is unacceptable.
    Perhaps there is documentation how to use JRE browser plugin, but googling yielded no results :(

    <offtopic>Apparently my login no longer working, re-registered</offtopic>
    ActiveX bridge won't do, I have to load an applet from any .jar
    The idea is to write kind of applet loader, which may be able to load jar and display applet.
    To start with, I need to know the way of paiting Java application GUI (i.e. JFrame) inside the native window.
    There is one way I've found. First, create borderless JFrame with some unique title, then use FindWindow in C++ Application to obtain HWND (window handle), and then call SetParent. I know there is more elegant way using JAWT to obtain HWND, the main problem is that Java window is rendered separately and only then becomes a part of native window, because HWND could be get on visible window only. This results unneccessary mess and flicking on screen for user.
    So, how can I render Java GUI directly to native window?
    I used search and haven't found solution.
    Thank you!
    PS found http://forum.java.sun.com/thread.jspa?forumID=52&threadID=5124062
    but this guy haven't said how he ded that :(
    Edited by: deniska25 on Oct 15, 2007 1:52 PM

  • Handling keyboard events in applets?! Possible?!

    Hello,
    I wrote a little game that uses keyboard handling events. It is an applet that can also standalone as an application. When i run the program as a standalone application, it handles keyboard inputs fine. ie...i can press the left and right arrow keys and something happens.
    But when i run my program as an applet in a web browser, the applet starts up correctly but does not handle any keyboard events. It only handles mouse events. For instance, if i press the up and down arrow keys, the browser window scrolls up and down!!! And the up and down arrow keys have a specific purpose in my applet.
    QUESTION: how do i get my applet to accept keyboard inputs such as UP,DOWN, LEFT, RIGHT?

    Hmm something went wrong w/ my post so i hope this doesnt show up twice.
    Hey thanks a lot for helping me out. The applet/application is large so here is the main() method and the keyboard event handling class code. My question is how come the keyboard events get properly handled when i run it as a standalone application, but keyboard events go to the browser when i run it as an applet? I would post my entire code but it's over 1000 lines and spread out over 8 files. hehehe.
    Here is main():
      public static void main(String[] args)
          MyProgram applet = new MyProgram();
          applet.isStandalone = true;
          JFrame frame = new JFrame();
          frame.setTitle("Physics: Kinematics");
          frame.getContentPane().add(applet, BorderLayout.CENTER);
          applet.init();                        // initialize the applet inside frame
          applet.addKeyListener(kbHandler);     // kbHandler is a keyboard handling object
          applet.start();
          frame.setSize(APPLETWIDTH,APPLETHEIGHT);
          Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
          frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
          frame.setVisible(true);
          // private inner class to terminate the Application when frame closes
          frame.addWindowListener(
            new WindowAdapter()
                public void windowClosing(WindowEvent e)
                    System.exit(0);
          frame.show();
       }"kbHandler" is the keyboard event handling object. It gets initialized in the applet.init() method.
    kbHandler = new BMkeyboardHandler();And here is the keyboard event handling code:
    // ===== keyboard event handler ===========
       private class BMkeyboardHandler implements KeyListener
            public void keyPressed(KeyEvent e)
                pushedKey = e.getKeyCode();
                // General administrative key actions
                if(pushedKey == KE.VK_H)
                    actionArea.toggleHelpMenu();
                    actionArea.repaint();
                else if(pushedKey == KE.VK_C)
                    actionArea.toggleCtrlMenu();
                    actionArea.repaint();
         }So there it is. Again, the program handles events fine as a standalone application. But running it as an applet in a browser (and even the appletviewer) doesnt let me handle keystrokes.

  • How To open applet inside AWT Frame

    Hi there !
    I want to open my applet directly inside a AWT Frame window from a hyper link...
    That is when a user clicks a hyper link i want to open my applet inside a AWT Frame...I do not want my applet to be opened inside a browser window is there any possibility to do this ...pls help me
    -Priya

    hi,
    i see one way, but i really do not know it works or not.
    Try the following:
    An applet is nothing more then a panel. So you can intanciate the applet:Class class1=new Class.forName(nameOfApplet);
    Applet a=(Applet)class1.newInstance(//maybe a parameter);
    frame.add(a);
    a.init(); //calling the init-method of the appletJust try, but I really can't commit you the workability.
    regards

  • Applet to Applet communication in one browser process with 2 windows

    Applet to Applet communication in Same IE process bu in different IE windows
    I have two IE windows
    (1) base window
    (2) child window (created through wondow.open() and hence share the same IE process and same JVM)
    Now I have two applets in one in base window and other is in child window and I want to do applet to applet communication. Since both applets are in different windows so AppletContext will not work and I tried to use custom AppletRegistory class to keep each Applet in static Hashtable. Now here comes the problem, Each applet gets different copy of this static Hashtable. i have tried hard to find the reason why a static varible has multiple copies running in the same JVM. Then my friend told me about something called class loader which is according to him is different for each window. I have tried this with two different iframes but in same window and it works fine and the reason being is that they share the same JVM. But why this fails for different windows althougt they also have same JVM?
    I am using JRE v5 update 7 and IE6 on WIN XP SP2.
    Thanks in advance..

    Try this example :
    Files used :
    1). AppletCom.html
    2). First.java
    3). Second.java
    1).AppletCom.html
    <HTML>
    <BODY bgcolor="#FFFFFF" link="#0000A0" vlink="#000080">
    <LI><H2><I>Inter applet communication Applet</I></H2>
    <applet code=First.class name="theFirst" width=250 height=100></applet>
    <applet code=Second.class width=350 height=100></applet>
    <BR>
    Source First.java Second.java
    <P>
    <HR>
    <i>Last updated 8/5/97 Martin Eggenberger</i>
    <HR>
    </BODY>
    </HTML>
    2). First.java
    import java.awt.*;
    <applet code="First" width="200" height="200">
    </applet>
    public class First extends java.applet.Applet {
    //Variables for UI
    Label lblOutput;
    public void init() {
    //Create the UI
    add(new Label("The First applet."));
    lblOutput = new Label("Click on a button in the Second applet.");
    add(lblOutput);
    public Color getcc()
    return Color.pink;
    public String getnm(int a,int b)
    int cnt=a+b;
    String str;
    str="Sum is :_________"+cnt;
    return str;
    public boolean handleEvent(Event event) {
    if ("One".equals(event.arg)) {
    lblOutput.setText("You clicked: One");
    return true;
    } else if ("Two".equals(event.arg)) {
    lblOutput.setText("You clicked: Two");
    return true;
    } else if ("Three".equals(event.arg)) {
    lblOutput.setText("You clicked: Three");
    return true;
    return super.handleEvent(event); }
    3). Second.java
    import java.awt.*;
    import java.applet.*;
    <applet code="Second.java" width="200" height="200">
    </applet>
    public class Second extends java.applet.Applet {
    //Declare the UI variables
    Button btnOne;
    Button btnTwo;
    Button btnThree;
         Applet f;
    Label lb;
    public void init() {
    //Build the UI
    btnOne = new Button("One");
    add(btnOne);
    btnTwo = new Button("Two");
    add(btnTwo);
    btnThree = new Button("Three");
    add(btnThree);
    lb=new Label("SUNO RE KAHANI TERI MERI SHHHHHHH");
    add(lb);
    setLayout(new FlowLayout());
    // lb.setSize(100,100);
    public boolean handleEvent(Event event) {
    if (event.id == Event.ACTION_EVENT && event.target == btnOne) {
         f = getAppletContext().getApplet(new String("theFirst"));
    First applet1=(First)f;
    // int cnt=applet1.givenum(22,25);
    // String str="Sum is:"+cnt+" Fine";
    String str=applet1.getnm(22,25);
    lb.setText(str);
    Color cl=applet1.getcc();
    setBackground(cl);
    return f.handleEvent(event);
    } else if (event.id == Event.ACTION_EVENT && event.target == btnTwo) {
    f = getAppletContext().getApplet(new String("theFirst"));
    return f.handleEvent(event);
    } else if (event.id == Event.ACTION_EVENT && event.target == btnThree) {
    f = getAppletContext().getApplet(new String("theFirst"));
    return f.handleEvent(event);
    return super.handleEvent(event);
    I had this example, so i am sharing it as it is.. instead of giving you any link for tutorial... hope this helps.
    Regards,
    Hiten

  • How to move multiple images in applet

    Hi,how to move multiple images in applet or random images in applet .
    Means moving images.gif around the applet with different starting point ,help me to create that move method ..

    why don't you check the tumbling duke applet as provided free in this site? :-)

  • Java Applet Certificate Signing Window comes up BLANK!

    Hi Everyone I have a problem where
    Java Applet Certificate Signing Window comes up BLANK!
    It comes up as blank gray panel with the java logo on the upper left.
    the title bar says "Java Plugin Security Warning"
    And I can't figure out what to do to make it come up properly. I tried double clicking it dragging it around to make it repaint itself nothing happens.
    I have tried clearing temp files deleting files from IE, deleting cookies, clearing the history.
    Now i'm going to restart the computer and see if it works.
    It is supposed to give me buttons.
    1. Accept for this session
    2. Grant
    3. Deny
    4. View Certificate
    But does anyone have any idea how to address this issue ?
    Stephen

    You might try setting the trace level to 5 in the plugin's Java console and looking what it spits out while the applet is launching. I remember seeing loads of information in there including stuff relating to certificate validation. It might be helpful.
    The trick to getting this info during start up:
    1) get the plugin to load by directing your browser to page with a known applet. Write your own little stub applet and load it or go to http://java.sun.com/. There's an applet on that page.
    2) bring up the plugin's console if it's not already and then go to a blank page.
    3) set the trace level to 5 in the console. (just press the 5 key).
    4) go to the page that launches your applet. You'll have tons of information pour out in your console.
    Happy hunting.

  • Applet inside a UIX screen

    I am trying to use an applet inside my UIX page. does anyone have any thought on how to do this. I am using Jdev 10g for this. I have gotten as far as the error "element OBJECT not defined in parent pageLayout"
    maybe I just need to know where to stick the code?
    any thoughts?
    thanks

    ok here is the code.
    I would like the applet to appear in the middle of the screen, but this is where I could get the applet to display, also I have not put in the side nav yet.
    thank for the time and effort.
    <content>
    <dataScope xmlns="http://xmlns.oracle.com/uix/ui">
    <provider></provider>
    <contents>
    <document>
    <metaContainer>
    <head title="Heading here"/>
    </metaContainer>
    <contents>
    <body>
    <contents>
    <form name="form0">
    <contents>
    <pageLayout title="Title">
    <corporateBranding>
    <image source="ennovation.jpg" />
    </corporateBranding>
    <tabs>
    <tabBar>
    <contents>
    <link text="Home" />
    <link text="Configuration" />
    <link text="Tracking" />
    <link text="ReferenceTables"/>
    </contents>
    </tabBar>
    </tabs>
    <pageHeader>
    <globalHeader>
    <contents>
    <link text=" "destination=""/>
    </contents>
    </globalHeader>
    </pageHeader>
    <globalButtons>
    <globalButtonBar>
    <contents>
    <globalButton text="ERO Suite" />
    <globalButton text="Contact Us" />
    <globalButton text="Help" />
    </contents>
    </globalButtonBar>
    </globalButtons>
    <contents/>
    </pageLayout>
    <pageLayout xmlns:html="http://www.w3.org/TR/REC-html40">
    <contents>
    <html:object classid="clsid:8AD9C840-044E-11D1-B3E9- 00805F499D93" width = "1250" height = "575" codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">
    <html:param name = "CODE" value = "com.nwoods.jgo.examples.flower.Flower" />
    <html:param name = "CODEBASE" value = "." />
    <html:param name = "ARCHIVE" value = "Flower.jar" />
    <html:param name="type" value="application/x-java- applet;version=1.3"/>
    <html:param name="scriptable" value="false"/>
    </html:object>
    </contents>
    </pageLayout>
    <pageLayout>
    <contents>
    <copyright>
    <styledText text="Ennovation Inc 2004"
    styleClass="OraCopyright"/>
    </copyright>
    <privacy>
    <link text="Privacy Statement" destination=""/>
    </privacy>
    </contents>
    </pageLayout>
    </contents>
    </form>
    </contents>
    </body>
    </contents>
    </document>
    </contents>
    </dataScope>
    </content>
    <handlers>
    </handlers>
    </page>

  • Multiple File Upload Applet

    I am attempting to code a JavaBean wrapped by an applet that will upload multiple files to a web server via the multipart/form-data mime-type.
    I have moved a number of files to the web server with limited success.
    I cannot move more than roughly 30Mbs of files in any configuration without causing a fatal exception.
    I am confident that it is a limitation of the client's VM and the memory allocated to the applet.
    I have seen several commercial grade applets that claim they can move any number of files even totalling 180Mbs.
    My applet is very simple. It opens a JFileChooser dialog box, allowing the user to select multiple files and communicates directly to a server side component that accepts multipart/form-data.
    I am navigating the protocol just fine. It seems to be a memory problem on the client side. Does anyone know how I can defeat this restriction and pass a reasonably high number of files (100-200) ranging from 50Mbs to 180+Mbs?
    Secondly, why does this happen: when I put my files onto the output stream, no files move accros the stream until I call .close(). How can I write the code to begin transferring bytes as soon as I call outputstream.write(xxx)?

    i am also developing multiple file upload applet and i transferred 1,4gb of data (2 files a 700MB) successfully.
    also, i just transferred a few hundred files with total size of 900mb to my localhost webserver (~5000kb/s)
    1) open file
    2) read a few kilobytes into buffer
    3) send them to the server
    4) flush the outputstream (!!)
    5) clear buffer and goto 2)
    6) if end-of-file, close the file and flush again.
    the outputstream is flushed every few kilobytes, so it will be sent over the socket to the server and not buffered until dawn.
    i don't know how the server-side is working, but i used apache/php script.
    you can try out my applet under
    http://www.haller-systemservice.net/jupload/

  • Creating multiple Threads in applets

    Hi, I need some help creating multiple threads in applets. If you look at the simple code example below you�ll see that it uses one thread that calls the findTarg() method that gives its sleep() a value and makes the oval find its new target.
    What I want to know is how do I create a new thread in this applet? � So for example I could call a findTarg2() method from within a new thread that sets its sleep() to a faster or slower value and starts at the same time as findTarg().
    Hope that makes sense.
    <applet code="thread.class" height=400 width=400>
    </applet>
    import java.awt.Graphics;
    import java.awt.*;
    import java.awt.event.*;
    public class thread extends java.applet.Applet implements Runnable {
    int x = 200;
    int y = 200;
    int xTarg;
    int yTarg;
    int sleeper;
    boolean go;
    Thread first;
    public void start(){
    if(first == null); {
    first = new Thread(this);
    first.start();
    public void run(){
    while (first != null) {
    findTarg();
    try {
    Thread.sleep(sleeper);
    } catch (InterruptedException e) { }
    public void findTarg(){    
    if(go == true){
    sleeper = 10;
    if(x < xTarg)x++;
    if(x > xTarg)x--;
    if(y < yTarg)y++;
    if(y > yTarg)y--;
    repaint();
    if((x == xTarg)&&(y == yTarg))go = false;
    public boolean mouseDown(Event evt, int x, int y) {
    xTarg= x;
    yTarg= y;
    go = true;
    return true;
    public void paint(Graphics g) {
    g.setColor(Color.black);
    g.fillOval(x,y,20,20);
    }

    I've found another example and this time it extends JApplet. I'm sorry I can't help you more, but I'm new as well.
    // Fig. 15.7: RandomCharacters.java
    // Demonstrating the Runnableinterface
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class RandomCharacters extends JApplet
    implements Runnable,
    ActionListener {
    private String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    private JLabel outputs[];
    private JCheckBox checkboxes[];
    private final static int SIZE = 3;
    private Thread threads[];
    private boolean suspended[];
    public void init()
    outputs = new JLabel[ SIZE ];
    checkboxes = new JCheckBox[ SIZE ];
    threads = new Thread[ SIZE ];
    suspended = new boolean[ SIZE ];
    Container c = getContentPane();
    c.setLayout( new GridLayout( SIZE, 2, 5, 5 ) );
    for ( int i = 0; i < SIZE; i++ ) {
    outputs[ i ] = new JLabel();
    outputs[ i ].setBackground( Color.green );
    outputs[ i ].setOpaque( true );
    c.add( outputs[ i ] );
    checkboxes[ i ] = new JCheckBox( "Suspended" );
    checkboxes[ i ].addActionListener( this );
    c.add( checkboxes[ i ] );
    public void start()
    // create threads and start every time start is called
    for ( int i = 0; i < threads.length; i++ ) {
    threads[ i ] =
    new Thread( this, "Thread " + (i + 1) );
    threads[ i ].start();
    public void run()
    Thread currentThread = Thread.currentThread();
    int index = getIndex( currentThread );
    char displayChar;
    while ( threads[ index ] == currentThread ) {
    // sleep from 0 to 1 second
    try {
    Thread.sleep( (int) ( Math.random() * 1000 ) );
    synchronized( this ) {
    while ( suspended[ index ] &&
    threads[ index ] == currentThread )
    wait();
    catch ( InterruptedException e ) {
    System.err.println( "sleep interrupted" );
    displayChar = alphabet.charAt(
    (int) ( Math.random() * 26 ) );
    outputs[ index ].setText( currentThread.getName() +
    ": " + displayChar );
    System.err.println(
    currentThread.getName() + " terminating" );
    private int getIndex( Thread current )
    for ( int i = 0; i < threads.length; i++ )
    if ( current == threads[ i ] )
    return i;
    return -1;
    public synchronized void stop()
    // stop threads every time stop is called
    // as the user browses another Web page
    for ( int i = 0; i < threads.length; i++ )
    threads[ i ] = null;
    notifyAll();
    public synchronized void actionPerformed( ActionEvent e )
    for ( int i = 0; i < checkboxes.length; i++ ) {
    if ( e.getSource() == checkboxes[ i ] ) {
    suspended[ i ] = !suspended[ i ];
    outputs[ i ].setBackground(
    !suspended[ i ] ? Color.green : Color.red );
    if ( !suspended[ i ] )
    notify();
    return;
    }

  • How to insert 2D applet inside the 3D applet

    i'm doing a project that requires the use of simple 2D applets inside the
    virtual world of Java3D...
    i'm a newbie in Java3D, i've searched the Java3D API specification, and i found nothing..
    can anyone help me .. or even give me an idea on how to do it??
    thanks

    take a look at the
    javax.media.j3d.Billboard
    class
    regards

  • Upload Friendly (Multiple File Upload Applet)

    Title : Upload Friendly (Multiple File Upload Applet)
    Description : UploadFriendly is an easy to use Java Applet that will allow multiple file
    uploads on a web server in a web page. The control supports file filtering, limits and more.
    Samples available in the following languages: ASP, ASP.NET, PHP, Coldfusion and JSP
    Link: http://www.uploadfriendly.com/
    Type: Commercial (30 days Trial)

    Hi shiil,
    To move the documents between site collection, content organizer rules would be a recommended method, you can activate Content Organizer features to enable content organizer rules on the site, to root the document to another site collection.
    Also, for this issue, as Prasath suggested, you can check out the document in the ItemAdded event, then add ItemCheckedout event, in the ItemCheckedout event, delete the document. Or as content organizer rule does, you can create your own timer job to move
    the document.
    More information, Content Organizer Feature Overview for SharePoint Server 2010 Developers (ECM):
    http://msdn.microsoft.com/en-us/library/office/ee558288(v=office.14).aspx
    Thanks,
    Qiao Wei
    TechNet Community Support

  • Embedding the Applets inside an activeX control

    Hi there !
    We r trying to embedd an applet inside activeX control.Anybody has any idea how to do this?
    Thanks,
    swami

    There is a tool available from Microsoft to do this (comes in part Microsoft SDK for Java) called javareg, this allows you to embedd java inside ActiveX. a search at http://support.microsoft.com will provide more info.
    Be wary of subsequent releases of the code though as there are dependencies on the generated type library. I think it only worked if further versions were created using the original type library can't remember but lots of headaches at the time.
    I think Sun provide an equivilent - java bridge ????
    ood luck I found it a real pain

  • How Can i COM Component inside Applet.

    Hi All,
    I want to use a COM component which is calling C API's inside an Java applet. Is there any way i can load COM dll inside applet and directly calls COM's functions.
    Pls give your suggestions.

    One more thing i would like to mention, I go through Implementation of Java Native Interface(JNI) and i can call COM fns through it but it is a longer procees as i have to write stub functions for each API implemented in COM component. If in my COM component is having 100 API then i have to write 100 such functions in JNI..
    I think there should be direct method of calling COM API;s
    Any suggestions.

  • Applet inside JSP trouble

    Hi,
    I am having trouble in configuring my application to run an applet inside my JSP pages.
    This is my dir structure:
    team/WEB-INF/classes/team/DBAccess.class
    team/WEB-INF/lib/ojdbc14.jar
    team/AppletClass/MyApplet.class
    team/reports/report.jsp
    team/main.jsp
    The Applet class MyApplet is called from within report.jsp by the following codes of line:
    <jsp:plugin type="applet" code = "MyApplet" codebase="../AppletClass/"></jsp:plugin>
    The applet works fine if I code it as a stand alone and not using DBAccess class. That is, it appear on my JSP page, however when I use elements from DBAccess class, which is inside WEB-INF/classes/team, it does not load!
    I have added D:\team\WEB-INF\classes\team into CLASSPATH variable of my win2K system.
    Please help!!! I somehow need this applet class to access DBAccess to query DB and display results on the applet.

    You are actually getting confused with server side execution and client side execution.
    Applet is something that run in client side.
    If you see your directory structure you have DBAccess.class in
    team/WEB-INF/classes/team/DBAccess.class directory
    hope you might be knowing WEB-INF is internal to app server not to the client. so applet can;t find the path for DBAccess.class file.
    You have to put that class in team/AppletClass or any other folder where the client applet can access .

Maybe you are looking for

  • Multiple Database Instances on Single Server and effect of NLS_LANG

    What is the effect of the NLS_LANG registry setting on a Windows server that is to host multiple database instance each created with a different database character set ? The server needs to support data in the following languages : Thai, Chinese Trad

  • Urgent: regarding ALV  report display problem

    hi, There are 3 problems:- 1.) I had made a ALV report in which i have to display 'POSTING DATE' (iseg-budat) when we execute the report i.e. it should be displayed as  PERIOD :- _______  to _______ on alv report .. 2.)the 2nd problem is dat when i u

  • JCO - RFC_ERROR_SYSTEM_FAILURE when executing BAPI_WHSE_STOCK_GET_LIST

    hello, I'm trying for hours now to execute the BAPI "BAPI_WHSE_STOCK_GET_LIST" from a java program. I can obtain its import, export and table parameterlist w/o any problems, but as soon as I invoke execute() on the function I'm getting the following

  • Change the info. in control record?

    hi...          how 2 change the information in control record?Not in ALE? bye.

  • Mapping External Message Error: StackOverFlowError

    Hi, Just to give a background first, I have an xsd external message defined, which I have to use for a certain map.  Whenever I try to use it as a target message during mapping, I get an INTERNAL_PROBLEM StackOverFlowError message.   Because of this,