Embedding an applet in an AWT frame

Hi there, just a quick question.
Is there a way that I can embed an Applet inside a AWT Frame? I know you have to use AppletStub somewhere. Thanks.

Hi,
I didn't use AppletStub. I just did:
import java.awt.*;
public class Main {
public static void main(String[] args) {
Frame frame = new Frame();
frame.add(new Thingy());
frame.setVisible(true);
Where Thingy() was the Applet's constructor.
Hope that helps!

Similar Messages

  • 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

  • How to tell embedded jinitator applet is still running when window closed

    Hello, we are trying to accomplish the same thing that is mentioned in this post from Metalink. I've searched for a solution and hope someone here can help. Instead of restating the issue I think David Wilson does a good job of explaining what is needed. Can anyone please suggest a possible solution?
    From: David Wilton 07-Oct-05 01:08
    Subject: How to tell embedded jinitator applet is still running when window closed
    How to tell embedded jinitator applet is still running when window closed
    Hi,
    We run an oracle 10g forms application through 9iAS over an intranet. All users are running windows 2000 professional.
    We run separate frame = true but I would like to switch to separate frame = false
    With separate frame = true if the user clicks the outer windows "X" close button (forms mdi window) the user is prompted to save changes before the application ends.
    BUT
    when using separate frame = false
    If the user clicks the upper window "X" button (no longer form mdi window but regular browser window) the window and application is abruptly closed.
    I'm interested in using a onbeforeunload function to confirm if the user wants to close the window. This would be placed in the basejini.htm file. This could always ask if the user wants to exit or not. If they click OK then the window closes but if they click "Cancel" you are returned to the forms application exactly where you left. something like event.returnvalue="do you really want to exit?";
    However if the user exited using the normal exit form method then the applet is already closed before the onbeforeunoad event fires and there is nothing to go back to and I want the window to close automatically. This is accomplished using close.html file in post forms trigger.
    So what I want and what I think many may also want is the check if the embedded applet is still running and if so prompt the user to return to the application or continue to close. Of course If the applet is no longer running then just close because there is no reason confirm closing anymore.
    Does anyone have a html/JavaScript solution that can be placed in the jinitiator.htm file? or similar?
    Thank you
    David
    [email protected]
    From: Andrew Lenton 07-Oct-05 08:58
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    I don't know if this is exactly what you are after but you can add the following to the top of your basejini.htm file and it should prompt the user before exiting the IE window.
    <BODY %HTMLbodyAttrs%>
    %HTMLbeforeForm%
    <SCRIPT>
    <!--
    window.onbeforeunload = unloadApplet;
    function unloadApplet(){
    message = "Warning! Please exit the Java Applet prior to
    exiting the browser"
    return message;
    //-->
    </SCRIPT>
    From: Oracle, mohammed pasha 07-Oct-05 09:55
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    David,
    Well I could not understand your complete requirement.
    Refer to Note.201481.1 How to Close the Browser Window When Closing Forms And How to Simulate SeparateFrame By Javascript
    Note.115905.1 How to Close Browser Window When Closing Webforms Applet
    Kind Regards,
    Anwar
    From: David Wilton 07-Oct-05 14:37
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    Thank you for your reply and yes you did not understand my question fully.
    Sorry if this is a long reply
    I am able to close the browser window using information in notes 115905.1 and 201481.1, this is not the issue. We implemented this several years ago. It is workable for both separate frame = true or false.
    It is most important to not allow the user to end their forms application by closing the windows browser, they must close using normal form exit commands.
    What I want is to have separate frame = false, the big drawback to this option is the user can exit the application and bypass all forms code by pressing the windows "X" close button. This is why we need the code as just provided by Andrew Lenton above in this thread.
    BUT Andrew's code will always prompt the user before closing the window and I do not want that. I want the user to be prompted only under scenario 2 listed below.
    Here's the 2 case scenario for exiting the application.
    1. If the user closes properly and uses exit form which fires all normal form triggers including post_form with it's call to close.html file.
    All uncommitted changes are saved or rollback and the users session is ended normally both on the database and in the application server.
    All browser windows will close, great all is good. And without Andrew's code the window will close but with Andrew's code the user will be prompted to close or not, if they select Cancel the window will remain but the applet has already ended so why prompt? ...This is what I want to avoid.
    2. In the forms app. if the user clicks the windows "X" close button with uncommitted changes. The browser just closes the changes are rollback without prompting the user to save. The users sessions are now lost and still running in the database and application server until they are timed out.
    If I use Andrew's code then the user will be prompted to continue to close or go back, if they click Cancel to go back then focus returns to the forms application and the user can continue to work. If the user clicks OK then the window closes and unfortunately their sessions are still lost until timed out.
    So what I desire is to add to Andrew's code to check if the embedded applet is still running and prompt the user to close or not accordingly.
    Something like:
    Basejini.htm like
    </HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    function maximizeWindow()
    window.moveTo(0,0);
    window.resizeTo(screen.availWidth,screen.availHeight);
    function confirm(){
    If(document.embeddedapplet.closed())
    Win.opener = self;
    win.close();
    Else if
    event.returnValue = "Closing Forms Application. OK to continue?";
    </SCRIPT>
    <BODY %HTMLbodyAttrs%, onload="maximizeWindow()", onbeforeunload="confirm()">
    %HTMLbeforeForm%
    I hope this explains my requirements.
    David
    From: Oracle, Evelene Raechel 10-Oct-05 06:45
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    Hi,
    Note.199928.1 How to Alert User on Closing Client's Browser Window in Webforms
    Regards,
    Rachel
    From: David Wilton 11-Oct-05 17:40
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    I'm sorry this is not helpful at all.
    Note 199928.1 is only an alert which does not stop the closing of the window and still displays as an alert if the user does close properly using exit form ... so why would you want to display the alert then?
    This is exaclty what I do not want and why I want to determine if the applet is still running before displaying any kind of message.
    David
    From: Oracle, Evelene Raechel 17-Oct-05 12:23
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    Closing thread.
    Thanks,

    Hello,
    I had the same issue last year - wanting to provide a warning on closing the browser, but only if the Forms session is still running. The approach I took is described below, see also the thread where I originally posted this at Closing brower window
    Hi there,I've had a similar requirement - or rather, the two conflicting requirements: to warn when the browser is being closed, but for the app to be able to close the browser without a warning being fired.
    To always provide a warning when someone (the user or the Forms app) tries to go to a different page (e.g. your close.htm), use Javascript like:
    function confirmExit(){
    if(appletRunning==true) {
    msg="Closing this window or navigating to another page will end your SomeGreatApp session.";
    window.event.returnValue=msg;
    And make a call to confirmExit() in the onBeforeUnload event of your main page.
    You'll notice I first check an 'appletRunning' variable before displaying the warning. This Javascript variable is set to true by my app when it starts up, using an embedded Javabean that calls out to Javascript. Once that variable is set to true, then the warning will be displayed if the user tries to shut the browser by clicking on the 'x' button, or to go to a different URL.
    When my app is shutting down, it uses the same Javabean to set appletRunning back to false. It then navigates to a close.htm - which will be done without a warning being displayed.
    See Re: How can a Javabean call Javascript function of the basejpi.html?? for example code on how to call Javascript from a bean embedded in your Forms app.
    Hope these ideas help you out, it's worked for me (so far, anyway!!)
    James

  • Very simple Java AWT Frame resize question

    In the following code, I create an awt Frame. Unfortunately, when I run the resulting Java application (on Windows) and use the mouse to resize the window, none of the Frame's resize/setSize methods get called. Can anyone explain why this is?
    Thanks
    Greg
    import java.awt.* ;
    public class Junk extends Frame {
    public static void main (String args[])
    Junk j = new Junk ();
    j.show ();
    public void resize(Dimension arg0)
    super.resize(arg0);
    public void resize(int arg0, int arg1)
    super.resize(arg0, arg1);
    public void setSize(Dimension arg0)
    super.setSize(arg0);
    public void setSize(int arg0, int arg1)
    super.setSize(arg0, arg1);
    }

    When the user resizes the frame with the mouse, the resizing action probably happens entirely on the Frame's peer, without the java.awt.Frame getting involved at all. setSize() and [deprecated] resize() allow an application to programmatically change the size of a Frame, but the Frame just passes the new size to its peer.
    If you want to detect when your Frame has been resized, use addComponentListener to register a component listener on the Frame, and then put your code in the componentResized method of the listener.

  • Resize applet within a HTML frame

    Hi,
    I am using an applet to display a tree in a HTML frame of a web page.
    I would like to resize or refresh the applet when the HTML frame is resized. Is there a way for the applet to know when the HTML frame is resized?
    Any help will be appreciated.
    Thanks

    I tried using the componentResized() method to solve this problem but I was unsuccessful.
    Here is what I tried:
    My application consists of using a Java applet to display a tree in a HTML frame. In addition I put the tree in a scroll pane. I tried using addComponentListener(this) to get the componentResized() method to be involked. I tried adding the component listener to the scroll pane:
    JScrollPane treeView = new JScrollPane(tree);
    treeView.addComponentListener(this);
    I tried adding the component listener to the root pane:
    JRootPane root = getRootPane();
    root.addComponentListener(this);
    and I tried adding the comoponent listener to the glass pane and the content pane.
    The componentResized() method was involked when the tree was initially displayed in some of my attempts but I was never able to get the componentResized() method to be involked when I resized the html frame.
    I believe that I am having a problem determining which component to add the addComponentListener to so that the componentResized() method get invoked when I resize the html frame.

  • Embedded video plays and then shows frame one at end.

    Hi,
    I have an embedded video that is approx 500 frames. It plays through but at the end, when it stops, it shows frame 1. At the end of the video I have placed stop();
    Any ideas on how to get it to stay at the last frame at the end?
    Thanks for any help.

    If you are playing the video in the timeline, shorten the number of frames that the video occupies until the video stops at the end. If yo are using the FLVPlayback component, set the autoRewind property to false.

  • How to load an applet in a swing frame?

    Hi All,
    Can any one tell how to load a HTML applet in a Swing frame, I have a requirement where in the swing frame must contain a HTML applet.
    Thanks in advance...
    Panneer.

    Panneerselvam wrote:
    Can any one tell how to load a HTML applet in a Swing frame, I have a requirement where in the swing frame must contain a HTML applet.You don't. The requirement reeks of the ridiculous.
    Also, what is an "HTML" applet and how is it different from a regular applet or JApplet? I feel a case of jargonitis coming on.

  • How to remove title bar in awt frame?

    how can i remove the title bar of frame and make it fullscreen so as to cover all the desktop?

    how can i remove the title bar of frame and make it
    fullscreen so as to cover all the desktop?foll should suffice in a simple situation
    import java.awt.Window;
    import java.awt.Frame;
    import java.awt.Toolkit;
    public class BigWindow extends Frame
         public BigWindow()
              //get screen size
              int height = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight();
              int width = (int)Toolkit.getDefaultToolkit().getScreenSize().getWidth();
              //make parent frame invisible
              this.setVisible(false);
              //create a new window without borders and titlebar
              Window window = new Window(this);
              window.setSize(width,height);
              window.setVisible(true);
         public static void main(String args[])
              new BigWindow();
    }

  • Anyone has ideas how to create Google Calendar as an embedded web applet

    Hello...
    Anyone has ideas how to create Google Calendar as an embedded web applet in CRM On Demand? I would like to create an embedded web applet to show up the user's Google Calendar. I may have users Google credentials saved in its user record of CRMOD.

    This can be enabled with InBound SSO implementation where your CRMOD Credentials and Google Apps Credentials are mapped.
    if it would help consider reading something on OpenSSO on SAML for this requirement
    Regards.
    Deepak H Andeli

  • Embedded Java applet no longer works correctly (works is old FFOX, Goggle Crome, etc.)

    an embedded Java applet pops up a response box with success or failure on a dbms update. With FFOX(32) 8.x and 9.x running on win7 64, the response box is blank but it should always be either Success or Failed.
    This works just fine in older FFox(with XP), Goggle Chrome(win7 64), etc.

    Hi and Welcome to the Forums!
    Anytime random strange behaviors creep in, the first thing to do is a battery pop reboot. With power ON, remove the back cover and pull out the battery. Wait about a minute then replace the battery and cover. Power up and wait patiently through the long reboot -- ~5 minutes. See if things have returned to good operation. Like all computing devices, BB's suffer from memory leaks and such...with a hard reboot being the best cure.
    Best!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How can I remove the lable "Warning:Applet window" of pop frame in a applet

    How can I remove the lable "Warning:Applet window" of pop frame in a applet? Not only in MS IE's JVM,but also in java plug-in 1.40, the warning always display , What can I do?
    ===
    thank you!

    You cannot remove the label. It is there intentionally as a security measure, to warn the user that the window is from a running applet, so that (s)he knows it might be dangerous to enter sensitive information there (any applet from anywhere on Internet could have opened the window, who knows if it is malicious or not!).
    Perhaps you can open a window without the warning when you sign your applet (with a security certificate).
    Jesper

  • How to Add AWT Frame to JMenubar....

    I was using AWT Frame for my project ... Now I want to add Menubar ... I was added AWT Menubar ... but its not looking fine .... So i want to add JMenubar ....
    What i will do....
    Thnaks in Advance...

    if you must
    import java.awt.*;
    import java.awt.event.*;
    class Testing
      public void buildGUI()
        javax.swing.JMenuItem open = new javax.swing.JMenuItem("Open");
        javax.swing.JMenuItem exit = new javax.swing.JMenuItem("Exit");
        javax.swing.JMenu menu = new javax.swing.JMenu("File");
        menu.add(open);
        menu.add(exit);
        javax.swing.JMenuBar menuBar = new javax.swing.JMenuBar();
        menuBar.add(menu);
        Frame f = new Frame();
        f.add(menuBar,BorderLayout.PAGE_START);
        f.setSize(200,100);
        f.setLocationRelativeTo(null);
        f.setVisible(true);
        f.addWindowListener(new WindowAdapter(){
          public void windowClosing(WindowEvent we){
            System.exit(0);
      public static void main(String[] args)
        EventQueue.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • How to disable the maximise button of a awt Frame

    Hi guys..
    Is there any way to disable the maximise button of the awt Frame (Not JFrame). I have tried the
    setResizable(false), but that one is not solving my problem. Any code will highly be Appreciated.
    tks in advance
    Jameel
    My ids r
    [email protected]
    [email protected]

    i used setResizable and it disables theframes max button
    import java.awt.*;
    import java.awt.event.*;
    public class frame extends Frame
    public frame()
    setSize(200,200);
    setVisible(true);
    setResizable(false);
    public static void main(String a[])
    new frame();
    what do u really need

  • How to prevent the automatic full-white repainting of an AWT Frame?

    Using Java 1.6.0, Windows XP, 1.6.0-b105 Client VM I have the following problem:
    I made a double buffered AWT frame. But it still flashes sometimes. It gives one flash about 6 seconds after start of application. There seems to be an incoming event "for no discernible reason". I have overridden all paint/repaint/update methods in my Frame sub class.
    These unwanted flashes are caused by the AWT painting the frame in white and then calling paint.
    I may have caught these weird calls:
    The good/normal case looks like:
    java.lang.Exception: Stack trace
    at java.lang.Thread.dumpStack(Thread.java:1206)
    at xed.xed_Frame.paint(xed_Frame.java:125)
    at xed.xed_Frame.update(xed_Frame.java:119)
    at sun.awt.RepaintArea.updateComponent(RepaintArea.java:239)
    at sun.awt.RepaintArea.paint(RepaintArea.java:216)
    at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:301)
    at java.awt.Component.dispatchEventImpl(Component.java:4486)
    at java.awt.Container.dispatchEventImpl(Container.java:2116)
    at java.awt.Window.dispatchEventImpl(Window.java:2429)
    at java.awt.Component.dispatchEvent(Component.java:4240)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
    The differences in the bad case: (Not all traces of this kind cause the flashing. But after all flashes there seems to be such a trace.)
    at xed.xed_Frame.paint(xed_Frame.java:125)
    at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
    at sun.awt.RepaintArea.paint(RepaintArea.java:224)
    at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:301)
    So how do I stop these unwanted white redraws of the Frame?

    Accidentally found the answer:
    System.setProperty("sun.awt.noerasebackground", "true");

  • Added Jcombobox into awt.frame causing handling event function cannot receive event

    Dear Sir,
    I want to ask how an awt.Choice  can set the number of rows that it can display, like the method setMaximumRowCount in JCombobox. Since I want to set more row can be displayed, but choice no any method can set. And I have tried to add Jcombobox into awt.frame, then, the handling event function cannot receive event for the right-top cornet button(minimize, maximum, close).
    Best Regards,

    please post a Short, Self Contained, Correct Example showing your problem.
    bye
    TPD

Maybe you are looking for