Keylistener breaks when implementing applet into application

I am currently trying to imbed my "Game" into an application to make a game menu for it. However, when
i try and do this the game loads fine but my keylistener doesnt work.
I am using the code.
import java.awt.*;
import java.applet.*;
public class RunApplets_BROKEN
public static void main (String [] args)
Applet myApplet = new Bomberman_Version_Aplha_EDITABLE (); // define applet of interest
Frame myFrame = new Frame ("Applet Holder"); // create frame with title
// Call applet's init method
myApplet.init ();
// add applet to the frame
myFrame.add (myApplet, BorderLayout.CENTER);
myFrame.setSize (500, 600);
myFrame.setVisible (true); // usual step to make frame visible
} // end main
} // end class
I know this is bad programming and i am trying to keep it simple, however when i do this to my other program it works fine. So i dont understand. Could anyone please help?

Intentional multi-post
[http://forums.sun.com/thread.jspa?threadID=5360722]
You were given two answers yesterday. Don't start a new thread because you didn't like them, that just wastes peoples time.

Similar Messages

  • Ever since I updated my Mac to Maverick it has become exceedingly slow everywhere. Also annoying, when I go into Applications to open something, it now automatically opens 3 things I don't need. What can I do to fix this?

    Ever since I updated my Mac to Maverick it has become exceedingly slow everywhere. Also annoying, when I go into Applications to open something, it now automatically opens 3 things I don't need. What can I do to fix this?

    Reinstall Lion, Mountain Lion, or Mavericks without erasing drive
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported then click on the Repair Permissions button. When the process is completed, then quit DU and return to the main menu.
    Reinstall Lion, Mountain Lion, or Mavericks
    OS X Mavericks- Reinstall OS X
    OS X Mountain Lion- Reinstall OS X
    OS X Lion- Reinstall Mac OS X
         Note: You will need an active Internet connection. I suggest using Ethernet
                     if possible because it is three times faster than wireless.

  • Mavericks doesn't ask for password when copying files into applications folder (e.g. installing plugins for After Effects)

    For example, when i was copied a plugin for after effects into the plugins folder, finder asked me for my password and now it doesn't. I can just copy it directly without any authentication.

    Do you have Service Pack 1 for Windows 7? It's listed in the system requirements for CC 2014. If you don't have SP1, AE won't run.
    That GPU sniffer error message is usually what happens. This should be a simple fix! Of course, you should always take the normal precautions when updating an OS, but still...

  • Run applet as application

    Hi To All,
    I'm converting a Applet into Application.
    All the things are runing well but when my Applet gets to try the access getDocumentBase() method
    its giving a nullPointerException
    My all code is written below please help me to find out the problem
    import java.awt.Frame;
    import java.awt.event.*;
    import java.awt.Dimension;
    import java.applet.Applet;
    // Applet to Application Frame window
    public class AppletFrame extends Frame implements java.awt.event.WindowListener
    public static void startApplet(String className, String title,String args[])
    { Dimension appletSize;
    try
    // create an instance of your applet class
    myApplet = (Applet) Class.forName(className).newInstance();
    catch (ClassNotFoundException e)
    { System.out.println("AppletFrame " + e);
    return;
    catch (InstantiationException e)
    System.out.println("AppletFrame " + e);
    return;
    } catch (IllegalAccessException e)
    System.out.println("AppletFrame " + e);
    return;
    } // initialize the applet myApplet.init();
    myApplet.start();
    AppletFrame f = new AppletFrame(title);
    f.add("Center", myApplet);
    f.addWindowListener(f);
    appletSize = myApplet.getSize();
    f.pack();
    f.setSize(appletSize);
    f.show();
    public AppletFrame(String name)
    { super(name);
    } public void windowClosing(java.awt.event.WindowEvent ev)
    { myApplet.stop();
    myApplet.destroy();
    java.lang.System.exit(0);
    } public void windowClosed(java.awt.event.WindowEvent ev) {}
    public void windowActivated(java.awt.event.WindowEvent ev) {}
    public void windowDeactivated(java.awt.event.WindowEvent ev) {}
    public void windowOpened(java.awt.event.WindowEvent ev) {}
    public void windowIconified(java.awt.event.WindowEvent ev) {}
    public void windowDeiconified(java.awt.event.WindowEvent ev) {}
    private static Applet myApplet;
    public static void main(String args[]){
    startApplet("appletImageBook.appletImage.Standalone2","XApplets",args);
    ====================================================
    And Standalone2.java is
    public class Standalone2 extends Applet {
    Image img ;
    public void init()
    { add(new Button("Standalone Applet Button"));
    img = getImage(getDocumentBase(),"images/office1.jpg");
    public void paint(Graphics g) {
    g.drawImage(img,0,0,null);
    =====================================================
    And while runing AppletFrame.java it is giving Error below
    ===============================
    Exception in thread "main" java.lang.NullPointerException at java.applet.Applet.getDocumentBase(Applet.java:125)
    at appletImageBook.appletImage.Standalone2.init(Standalone2.java:20) at appletImageBook.appletImage.AppletFrame.startApplet(AppletFrame.java: 38)
    at appletImageBook.appletImage.AppletFrame.main(AppletFrame.java:99)
    ===============================
    Any type of help will be fine for me
    Thanks in advance

    The only difference between an applet and an application should be the way they are started.
    Instead of adding an applet to a frame, open a frame from the applet. Open the same frame from your application.
    Or instead of a frame, use a (J)Panel. Add it directly to your applet, or add it to a new frame when you want to run it as an application.
    In any case: separate the way the UI is created from the way the application is started.

  • Keylistener broken when applet implemented into application

    I am currently trying to imbed my "Game" into an application to make a game menu for it. However, when
    i try and do this the game loads fine but my keylistener doesnt work.
    I am using the code.
    import java.awt.*;
    import java.applet.*;
    public class RunApplets_BROKEN
    public static void main (String [] args)
    Applet myApplet = new Bomberman_Version_Aplha_EDITABLE (); // define applet of interest
    Frame myFrame = new Frame ("Applet Holder"); // create frame with title
    // Call applet's init method
    myApplet.init ();
    // add applet to the frame
    myFrame.add (myApplet, BorderLayout.CENTER);
    myFrame.setSize (500, 600);
    myFrame.setVisible (true); // usual step to make frame visible
    } // end main
    } // end class
    I am wondering if the problems exists in where i am calling the keylister into the application but it does not call
    the methods (such as keylistener), altho i call the init method in the application. Do i have to call the keypressed and such methods also?

    The way you are approaching this is not a good idea though.
    Don't try and plug an applet into a Frame. It's not that simple. An applet has a context for example and yours doesn't. If you have a program that you want to use as both an applet and an application then you should make your applet just behave as the bootstrapping component and take your GUI stuff to another class. Then you can use this common class (maybe a JPanel/Panel) in multiple places (Frame, Applet, etc).

  • How can I implement an iphone application, it hides when started running?

    Hi
    Is there anyone who can be tell me whether it is possible to implement an iphone application in such a way that it hides automatically when starts running. If it it possible, please help me how it can be implemented. As I need it for my application, this application will only update current gps data into the server at regular interval that is set by the user.
    Thanks.

    No background processes are allowed on the iPhone.

  • Can't see list of minimized windows when I minimize windows into application

    I love the Mac option to minimize windows into application icon, but recently it's behaving abnormally for me. When I minimize, for example, three Word documents into the application icon, I don't see the list of those documents when I click on the icon (they usually stack vertically in the menu, above "Options"). To see those documents, I have to click the application icon and select "show all windows".
    I can't figure out what's going on, and it's driving me nuts.
    What I'm seeing (I have three documents minimized into the Word application here):
    What I should be seeing (This is just a screen grab from a tutorial, not my machine):
    Here are my current dock preferences/settings:
    I've already rebooted. Any ideas? Thanks in advance!!

    You need to look in your user Library/Preferences for the .plist. Hold down the option key while using the Finder “Go To Folder” command. Enter ~/Library/Preferences/com.apple.dock.plist.  Move the .plist to the trash..
    In Applications/Utilities/Terminal type
    killall Dock
    Restart and test. You may have to update your dock to the way you want it.
    If you prefer to make your user library permanently visible, use the Terminal command found below.
    http://osxdaily.com/2011/07/04/show-library-directory-in-mac-os-x-lion/
    You might want to bookmark the command. I had to use it again after I installed 10.8.4. I have also been informed that if you drag the user library to Finder it will remain visible.

  • Hi i haven't updated my iDVD seen 2005 and to get the new one i need 7.0.4 first and i downloaded it from the apple website and when i go into the updating process its says "An eligible iDVD application was not found in the location /Applications." why"

    Hi i haven't updated my iDVD seen 2005 and to get the new one i need 7.0.4 first and i downloaded it from the apple website and when i go into the updating process its says "An eligible iDVD application was not found in the location /Applications." why

    Because you need to buy iLife 08 or newer on DVD first. If you're using iDVD 05, you probably have a PowerPC Mac and can't use iLife 11.
    (69573)

  • When I capture from tape, express 4 now breaks my captured material into separate shots, an icon in the browser for each. Before it captured the whole clip till I hit escape, and created just one Icon. How to i get back the way it was.

    When I capture material from tape with final cut express 4, it used to create one icon for the whole clip. Now, when i capture, it breakes  the material down into many browser icons, shot by shot. I dont want that. How to I return to what I ahd before/

    What you describe is normal behavior for HDV capture using FCE.
    DV captures as one clip or may split the clip if there are timecode breaks on the tape.
    HDV always breaks clips at the shot changes using FCE.
    HDV cameras can downconvert to DV even if HDV was used to record the footage so it's important to know what the camera outputs during FCE capture.
    Maybe this is why you have had mixed results with the differing capture windows?
    Al

  • I am working on a book in the book module of Lightroom. When I started, I didn't realize that there was a limit of 240 pages. I am going to need to break this book up into two books now. Is there anyway to move pages from one book and create a new book wi

    I am working on a book in the book module of Lightroom. When I started, I didn't realize that there was a page limit of 240 pages. I am going to need to break this book up into two books now. Is there a way to take pages from one book to start a second book without having to "redo" the pages again in the new book?

  • How to integrate applet into web dynpro java application

    Hello Exprt,
    I am struggling with integrating applet into WD applciation. I don't see any applet specific UI element. I would highly appreciate your help.
    Thanks,
    Shubhangi

    Satyajit Chakra...
    Please can you clarify what you mean that it has been deprecated?
    We have a similar requirement and I have tested a method to do this on our NW 04 system that worked.  But I really need to know what to plan for when we upgrade to 04s.
    I am not sure if this is the right approach, but here's how I did it on our 04 system....I need to know if the approach I have taken below will work properly in 04s.
    I built an HTML file in a string which contains javascript to launch the IXOS viewer applet...which is the "inString" below...
              try
                   String html = inString;
                   IWDCachedWebResource resource = WDWebResource.getWebResource(inString.getBytes("UTF-8"), WDWebResourceType.HTML);
                   resource.setResourceName("HTML_inline.html");
                   resource.setAttachement(false);
                   resource.setReadOnce(false);
                   wdContext.currentContextElement().setOut(resource.getAbsoluteURL());
              catch (final Exception ex)
                   wdComponentAPI.getMessageManager().reportException(new WDNonFatalException(ex), false);
              IWDWindowInfo windowInfo = wdComponentAPI.getComponentInfo().findInWindows("PopupImageViewer");
              IWDWindow window = wdComponentAPI.getWindowManager().createWindow(windowInfo, true);
              window.setTitle("Image opening in separate window");
              window.setWindowPosition(25, 225);
              window.open();
              wdContext.currentPopupElement().setWindowInstance(window);

  • Unable to download application app will be available for download when you log into the itues store on your computer

    My Ipad 2 keeps asking:-
    "unable to download application 'app' will be available for download when you log into the itunes store on your computer"
    If i connect it to the computer it is fine for around a week then it starts asking to be connected again, Is their any reason for this? as it is very annoying espicailly when access to a pc is difficult

    There is a 20mb file size limit over 3G.
    If you can connect via wifi, there is no file size limit.
    If that is not what you mean, I have no idea-never heard of or seen a message like you describe.

  • Converting an Applet into an Application

    I think I understand the basics of converting an Applet into an Application but Iam unsure on how you would go about passing the parameters that are normally stored in the HTML tag into the application.

    Basically you'll need to provide your own getParameter
    method. It's easy with a java.util.HashTable -- the
    parameter name as the key.that means that i would have to go back and change the old code, correct?

  • What does it mean when I log into Facebook and a pop-up comes out saying "[JavaScript Application] Error: jQuery("#fb_menu_account a", document).attr("href") is undefined"?

    What does it mean when I log into Facebook and a pop-up comes out saying "[JavaScript Application] Error: jQuery("#fb_menu_account a", document).attr("href") is undefined"? I would like to know what I can do to fix this. The site ends-up running slow. I have tried clearing the cookies and cache, but that doesn't work.
    == URL of affected sites ==
    http://www.facebook.com

    Does is still happen in Firefox Safe Mode. See [[Safe Mode]].
    If so, it's probably being caused by an add-on.

  • When i logged into itunes on my computer, all of my applications and music i had bought on my ipod were erased, what do i do?! Help!

    When i logged into itunes on my computer, all of my applications and music i had bought on my ipod were erased, what do i do?! Help!

    allears2 wrote:
    I just purchased a new laptop and I am trying to transfer my iTunes library to my new laptop...
    To have  EVERYTHING  on your New computer...
    From your OLD computer...
    Copy your ENTIRE iTunes FOLDER to an External Drive... and then from the External Drive to your New Computer..
    Full Details Here  >  http://support.apple.com/kb/HT1751
    An Added Bonus is that you will have a Backup of iTunes.

Maybe you are looking for

  • Dual video displays?

    I have a late 2012 Mac Mini. I want to run dual video displays, but do not want to spend $2,000 on Apple displays. What are my options? I was told that I could only use one of the display outputs at a time.

  • Can't Launch FW8 from DW8...wrong path

    DW8 and FW8 are installed on D:. Both open from their icons. In DW8, when I click an image in the files section I get the error: Unable to launch C:\Program Files\Macromedia\Fireworks 8\Fireworks.exe I went to Preferences File Types/Editors and (by b

  • Make tabs invisible in BP (business partner master creation)

    Hi, How do I disable tabs which are not necessary in BP transaction code? I want only few tabs which are relevant and make all other invisible. Your inputs are appreciated. Regards Komal

  • WiDi on Yoga 13

    Hello, Lenovo! Please, tell me one thing: is it possible to install any Intel mini-PCIe wireless adapter with WiDi support (like Intel® Dual Band Wireless-AC 7260) into free mini-PCIe slot and get WiDi on Yoga 13 (with Core i7 3537U)?

  • Music app in the iPad & iphone (iOS 6)

    i'm just wondering why, when i use the music app in the iPad (iOS 6) i can't see the lyrics, while in the iphone (iOS 6 too) i can see them????