Applets in Applet Tutorial Fail

I am trying to work through the tutorial on applets. Every page in this tutorial with an applet in it fails to load the applet. For example, when I load http://java.sun.com/docs/books/tutorial/deployment/applet/browser.html I get the following error:
General Exception: javal.lang.NoClassDefFoundError: ShowDocument$1
at ShowDocument.init(ShowDocument.java:22)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source).
This happens in both Firefox and IE.
According to the coffee cup that appears in my taskbar when I load a page with an applet, I am running J2SE 1.5.0_04-b05.
Other applets, incuding some in other parts of the tutorial, work fine.
Any suggestions would be much appreciated.

Sounds like you're copying the compiled classes
somewhere, but aren't copying the complete set of
them.
ShowDocument$1 -- there should be a
ShowDocument$1.class file where you compiled
ShowDocument.java -- you need to include the above
class file in your build as well.Go to the link posted. That is a Sun Tutorial page. The applet fails to load with this stack trace.
java.lang.NoClassDefFoundError: ShowDocument$1
     at ShowDocument.init(ShowDocument.java:22)
     at sun.applet.AppletPanel.run(Unknown Source)
     at java.lang.Thread.run(Unknown Source)
Exception in thread "thread applet-ShowDocument.class" java.lang.NullPointerException
     at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
     at sun.plugin.AppletViewer.showAppletException(Unknown Source)
     at sun.applet.AppletPanel.run(Unknown Source)
     at java.lang.Thread.run(Unknown Source)
This is more Sun crapola.

Similar Messages

  • HT1199 The applet is failed to start keeps popping up.  Why is this happening

    I am attempting to submit a power point presentation and need to have a program called Kaltura record images from my screen.  Every time I try I get the statement applet is failed.  Can someone help me with this issue.  I am using a Mac 10.9.  This is my last class before I graduate and I have to submit this presentation before 11/7/14

    Not needed from the App Store. Go straight to the developer.
    http://www.devontechnologies.com/products/freeware.html
    Also FindAnyFile, which if you Option click Find will search as root.
    http://apps.tempel.org/FindAnyFile/index.php
    For EasyFind, enter the name of the developer or anything else associated with it.

  • Applet.getParameter fails to read all parameters

    I have an applet that fails to read all the parameters (using the getParameter method) provided to it with PARAM tags. Eventually I realised that the cause was a tag:
    <param name="1.mpname" value="x">
    Not only could this parameter not be read, but getParameter couldn't read any parameters that came after this (in the HTML code) either. I realise starting a parameter name with a non-alphabetic character is a bit silly, but I'm writing this to conform to a W3C specification so I don't have much choice in the matter.
    Can anyone else confirm this problem? Is there a workaround?
    Thanks,
    Richard 'Tony' Goold

    The HTML is:
    <OBJECT
    height=20
    width=20
    classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">
    <PARAM NAME=ARCHIVE VALUE="MicroproductLinkSigned.jar">
    <PARAM NAME=CODE VALUE="com/inexum/Nickel/MicroproductLink/PerFeeLinkHandler.class">
    <PARAM NAME=TYPE VALUE="application/x-java-applet;version=1.3">
    <PARAM NAME=SCRIPTABLE VALUE="false">
    <PARAM NAME="price" VALUE="0.05USD">
    <PARAM NAME="textlink" VALUE="Product.html">
    <PARAM NAME="requesturl" VALUE="http://rgoold:8080/servlet/com.inexum.Nickel.Merchant.PurchaseServlet">
    <PARAM NAME="1.mpname" VALUE="http://www.inexum.com/">
    <PARAM NAME="1.mpurl" VALUE="http://www.inexum.com/">
    <PARAM NAME="title" VALUE="Product1">
    <PARAM NAME="duration" VALUE=200>
    <PARAM NAME="longdesc" VALUE="Music - Artist=Alpha Song=Beta"
    <PARAM NAME="mpRMI" VALUE="//rgoold/Merchant">
    <PARAM NAME="buyid" VALUE="zxcvbnm">
    </OBJECT>And the code is just a series of calls to getParameter, e.g.,
    String price = getParameter("price");
    String requestURL = getParameter("requesturl");
    String svc1 = getParameter("1.mpname");
    String title = getParameter("title");But any of the parameters that come after 1.mpname (the first invalid parameter name) in the HTML code are not picked up. So in the example I've given, "title" would return null. If I move the title PARAM tag to before 1.mpname, my getParameter call picks it up. I'm assuming the Applet class just throws an exception parsing PARAM tags and stops after the first invalid one.
    I'm using IE 5.5 on Windows 2000 to test this out.

  • A strange applet selection fail problem

    Hi, All. I am trying to implement the RSA encryption and decryption using rmi. I use the RSA implementation sample code in the previous post and the RMIPurse sample code in the package (3.0.2 classic ) for testing. However, after I add some initialization codes into the PurseImpl class, I got the "applet selection failed" error.
    The code that I modified based on RMIPurse
    import javacard.framework.ISO7816;
    import javacard.framework.ISOException;
    import javacard.security.CryptoException;
    import javacard.security.KeyBuilder;
    import javacard.security.KeyPair;
    import javacard.security.RSAPrivateCrtKey;
    import javacard.security.RSAPublicKey;
    import javacardx.crypto.Cipher;
    public class PurseImpl extends CardRemoteObject implements Purse {
        private short balance = 0;
        private byte[] number;
         // crypto variables
         final static byte GETSET_CLA = (byte) 0x85;
         final static byte CRYPT_CLA = (byte) 0x00;
         // Instruction set for SimpleString
         final static byte SET = (byte) 0x10;
         final static byte GET = (byte) 0x20;
         final static byte SELECT = (byte) 0xA4;
         // This buffer contains the string data on the card
         byte TheBuffer[];
         // globals
         RSAPrivateCrtKey rsa_PrivateCrtKey;
         RSAPublicKey rsa_PublicKey;
         KeyPair rsa_KeyPair;
         Cipher cipherRSA;
         final short dataOffset = (short) ISO7816.OFFSET_CDATA;
        public PurseImpl() {
            super(); // export it
            number = new byte[5];
              // crypto
            TheBuffer = new byte[100];
            // generate own rsa_keypair
            try {
                   rsa_KeyPair = new KeyPair(KeyPair.ALG_RSA_CRT, KeyBuilder.LENGTH_RSA_1024);
                   rsa_KeyPair.genKeyPair();
                   rsa_PublicKey = (RSAPublicKey) rsa_KeyPair.getPublic();
                   rsa_PrivateCrtKey = (RSAPrivateCrtKey) rsa_KeyPair.getPrivate();
                   cipherRSA = Cipher.getInstance(Cipher.ALG_RSA_PKCS1, false);
              catch (CryptoException e) {
                short sw = (short) 0x9100;
                sw |= e.getReason();
                ISOException.throwIt(sw);
        }I got:
    Receiving initial reference... java.rmi.RemoteException: Applet selection failed, SW = 6d00
    That's strange. because without the initialization codes in try/catch block, there is no problem to select the applet. Can anyone help?

    I have exactly the same problem when calling (trying to) any applets method. Where are these parameters to be turned on?

  • Applet loading Failed .... for diagnostics-console-extension.jar

    Hi everybody,
    i downloaded diagnostics-console-extension.jar from bea site. i copied this file to D:\bea9.0\user_projects\domains\mydomain\console-ext. i started weblogic server . in administration console when i clicking WLDF console extension tab it gives the Applet loading failed....and also in server console it gives an exaception as follows ""
    java.lang.ClassNotFoundException: jsp_servlet._com._bea._diagnostics._dashboard.
    __chartpanelapplet_class.
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
    mpl.java:512)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
    a:224)
    at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(Servlet
    StubImpl.java:383)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
    a:298)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
    a:165)
    Truncated. see log file for complete stacktrace
    >
    in Java console output Exception
    Java Plug-in 1.5.0_06
    Using JRE version 1.5.0_06 Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\mselvan
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    p: reload proxy configuration
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    java.lang.ClassFormatError: Truncated class file
         at java.lang.ClassLoader.defineClass1(Native Method)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Exception in thread "Thread-5" java.lang.NullPointerException
         at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
         at sun.plugin.AppletViewer.showAppletException(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    java.lang.NullPointerException
         at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
         at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Exception in thread "thread applet-com.bea.diagnostics.dashboard.ChartPanelApplet.class" java.lang.NullPointerException
         at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
         at sun.plugin.AppletViewer.showAppletException(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    so kindly any one help for the same.please help me
    Thanks & regards
    Selvan.M

    Several issues with the diagnostic console extension have been fixed in WLS 9.2. Can you try the extension from 9.2? WLS 9.2 is now ready for download from the BEA site.
    Thanks

  • Applet Loading Failed

    Hi ,
    when Im running my first applet program I get an error in the browser
    Applet Loading failed
    Applet not inited
    but when I run through command line i.e./usr/java/jdk1.5.0_03/bin/appletviewer /home/root/Hello.html
    It works very cutely.
    What could be the problem
    my Enviornment variables are as follows
    PATH="$PATH:/usr/java/jdk1.5.0_03/bin:."
    export PATH
    JAVA_HOME=/usr/java/jdk1.5.0_03/
    export JAVA_HOME
    CLASSPATH=/usr/java/jdk1.5.0_03/lib/tools.jar
    export CLASSPATH
    Can some one help me out

    use the htmlconverter tool in the jdk bin direcotory.
    The applet tag has been depreciated for some time now and should be used with legacy
    applets (msjvm) allthough the jre installation is pretty eagor to run those applets for you
    it can't in most cases (com.ms packeges).
    The object tag should be used when your applet is above java version 1.1.2 or msjvm
    might be trying to run an applet it can'r run.

  • Applet Loading Fails

    Hi
    Applet Loading Fails in Internet Explorer, I tried the follwing two solutions I found on www.java.com
    1.
    # Double click the icon to open the "Java Control Panel"
    # In the "Java Control Panel", select the Browser Tab
    # Make sure the box next to Internet Explorer, Netscape, or Mozilla is checked
    # If it is not checked, click the checkbox to enable the JRE for your Web browser
    # Click the Apply button.
    2.
    #Click "Tools" --> "Internet Options"
    #Select the Advanced Tab, and scroll down to "Java (Sun)"
    #Check the box next to the "Use Java 2" version
    #Next, select the Security Tab, and select the "Custom Level" button
    #Scroll down to "Scripting of Java applets"
    #Make sure the "Enable" radio button is checked.
    #Click OK to save your preference.
    but the problem still continues. Can it be my Java version, I tried it with both Java 5 and 1.4

    What kind of error message do you get?
    KajIt just displays the grey area where the applet is supposed to be and writes applet loading failed on the status bar

  • Java applet loading fails

    Hi,
    I am having JRE 1.5.0_08 version on my system. But after I have installed this version I am receiving the following message in the status bar.
    Loading Java Applet Failed
    When I uninstall this version...the applet works properly. Do I need to install any patch or Do I need uninstall the version
    Thanks in advance,
    Sudheer

    I found this Metalink that solved my problem.
    Note:171159.1

  • Deploying an Applet Tutorial

    Hi,
    I followed the instructions for the creating an applet and deploying it tutorial in JDEV 3.1.1.2. The applet works in the IDE but when I try to run it from the browser, IE just hangs and Netscape 4.7 gives a "Data Applet notinited" message.
    In the example, the tutorial was ambiguous about whether the profile name should be different from the name of the profile for the application module since the default name in both cases was Profile.prf. I made the names different.
    Is there something that I have to change in the html file?
    Thanks in advance.
    Peter

    a file named swingall.jar is there in
    jd jfc\lib directory.copy that file to
    your applet html folder and add a proper
    plug-in it will work.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Peter H():
    Hi,
    I followed the instructions for the creating an applet and deploying it tutorial in JDEV 3.1.1.2. The applet works in the IDE but when I try to run it from the browser, IE just hangs and Netscape 4.7 gives a "Data Applet notinited" message.
    In the example, the tutorial was ambiguous about whether the profile name should be different from the name of the profile for the application module since the default name in both cases was Profile.prf. I made the names different.
    Is there something that I have to change in the html file?
    Thanks in advance.
    Peter<HR></BLOCKQUOTE>
    null

  • Trouble with applet tutorial about servers

    I downloaded the sources of this (http://java.sun.com/docs/books/tutorial/deployment/applet/clientExample.html) example and am trying to make them work. However I'm having trouble with the server program.It compiles fine but when I run it I get NullPointerException in QuoteServerThread class on this line:
    packet = new DatagramPacket(buf, 256);buf is a byte array and it's set to null.
    I don't have any experience with networking in java so if the problem is something really simple you'll know why I didn't find it.
    Oh, and the code of the thread is here http://java.sun.com/docs/books/tutorial/deployment/applet/examples/QuoteServerThread.java

    Replace
    byte[] buf = null;with
    byte[] buf = new byte[ 256 ];Other problems may happen if this sample was not tested properly.
    The problem is that the DatagramPacket requires you to supply a non-null buffer, as per:
    DatagramPacket
    public DatagramPacket(byte[] buf, int length)
    Constructs a DatagramPacket for receiving packets of length length.
    The length argument must be less than or equal to buf.length.
    Parameters:
    buf - buffer for holding the incoming datagram.
    length - the number of bytes to read.
    Edited by: baftos on Jul 18, 2008 3:38 PM

  • Applet loading fails: ClassNotFound exception onlyyyy on linux

    Hello,
    I have a server on my embedded device with WinCE, and this server has the jar files and html files. connecting with Windows is working fine and Java applet loads and runs perfectlly.
    The problem is with linux clients, I can't load the applet.
    I expected to havesomething wrong with the plugin, But I tried with the test applets on www.sun.com and they are working fine.
    The error is ClassNotFoundException and http connection failed, although when I take the URL copy/paste from the Java console to the address bar of the firefox it downloads the class file. so the path is OK.
    Also I can run with the appletviewer and it works perfect like the case with windows. The problem is with the browser, It can'T load the applet from a remote machine.
    Also I made an empty applet with a button on it to check may be I should compile on linux!! but also this failed, I could load this applet locally (the html and class files on desktop) and when I places them on the server in the directory configured to be the www public directory It is not loaded. And again this test applet laoded on windows machines.
    I use the same JRE version on linux and windows and the same JDK.
    I use on windows Opera/ Firefox/ explorer and all are working, on linux I use Firefox/ Konqurer/ Epiphany and all are not working.
    Any Idea?????
    Thanks in Advance

    Hello,
    I have a server on my embedded device with WinCE, and this server has the jar files and html files. connecting with Windows is working fine and Java applet loads and runs perfectlly.
    The problem is with linux clients, I can't load the applet.
    I expected to havesomething wrong with the plugin, But I tried with the test applets on www.sun.com and they are working fine.
    The error is ClassNotFoundException and http connection failed, although when I take the URL copy/paste from the Java console to the address bar of the firefox it downloads the class file. so the path is OK.
    Also I can run with the appletviewer and it works perfect like the case with windows. The problem is with the browser, It can'T load the applet from a remote machine.
    Also I made an empty applet with a button on it to check may be I should compile on linux!! but also this failed, I could load this applet locally (the html and class files on desktop) and when I places them on the server in the directory configured to be the www public directory It is not loaded. And again this test applet laoded on windows machines.
    I use the same JRE version on linux and windows and the same JDK.
    I use on windows Opera/ Firefox/ explorer and all are working, on linux I use Firefox/ Konqurer/ Epiphany and all are not working.
    Any Idea?????
    Thanks in Advance

  • Applet load failing with update 20

    Hello,
    I have an applet that was working up to update 18. The applet has a web services client that now fails when being instantiated with 1.6 u20
    The stack track indicates it is related to security. If anyone has any clues on what the cause is or how to troubleshoot, that would be great.
    Thanks
    Exception in thread "thread applet-1" java.lang.ExceptionInInitializerError
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at javax.xml.ws.spi.FactoryFinder.newInstance(Unknown Source)
         at javax.xml.ws.spi.FactoryFinder.find(Unknown Source)
         at javax.xml.ws.spi.Provider.provider(Unknown Source)
         at javax.xml.ws.Service.<init>(Unknown Source)
    <snip>
    Caused by: java.lang.NullPointerException
         at sun.plugin2.applet.Plugin2ClassLoader.getTrustedCodeSources(Unknown Source)
         at com.sun.deploy.security.CPCallbackHandler$ParentCallback.strategy(Unknown Source)
         at com.sun.deploy.security.CPCallbackHandler$ParentCallback.openClassPathElement(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$700(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$3.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath.findResource(Unknown Source)
         at java.net.URLClassLoader$2.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findResource(Unknown Source)
         at sun.plugin2.applet.JNLP2ClassLoader.findResource(Unknown Source)
         at java.lang.ClassLoader.getResource(Unknown Source)
         at sun.plugin2.applet.JNLP2ClassLoader.access$001(Unknown Source)
         at sun.plugin2.applet.JNLP2ClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.plugin2.applet.JNLP2ClassLoader.getResource(Unknown Source)
         at java.lang.ClassLoader.getResource(Unknown Source)
         at sun.plugin2.applet.JNLP2ClassLoader.access$001(Unknown Source)
         at sun.plugin2.applet.JNLP2ClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.plugin2.applet.JNLP2ClassLoader.getResource(Unknown Source)
         at javax.xml.bind.ContextFinder.find(Unknown Source)
         at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
         at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
         at com.sun.xml.internal.ws.spi.ProviderImpl$2.run(Unknown Source)
         at com.sun.xml.internal.ws.spi.ProviderImpl$2.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.xml.internal.ws.spi.ProviderImpl.getEPRJaxbContext(Unknown Source)
         at com.sun.xml.internal.ws.spi.ProviderImpl.<clinit>(Unknown Source)
         ... 19 more

    In case this helps, just before the exception is thrown the java console shows:
    basic: JNLP2ClassLoader.findClass: xxx: try again ..
    security: Loading certificates from Deployment session certificate store
    security: Loaded certificates from Deployment session certificate store
    security: Loading certificates from Internet Explorer TrustedPublisher certificate store
    security: Loaded certificates from Internet Explorer TrustedPublisher certificate store
    security: Validate the certificate chain using CertPath API
    security: Obtain certificate collection in Root CA certificate store
    security: Obtain certificate collection in Root CA certificate store
    security: Start to check whether root CA is replaced
    security: The root CA hasnt been replaced
    security: No timestamping info available
    security: Found jurisdiction list file
    security: No need to checking trusted extension for this certificate
    security: The CRL support is disabled
    security: The OCSP support is disabled
    security: This OCSP End Entity validation is disabled
    security: Checking if certificate is in Deployment denied certificate store
    security: Checking if certificate is in Deployment permanent certificate store
    <above repeats many times>
    ecurity: This OCSP End Entity validation is disabled
    security: Checking if certificate is in Deployment denied certificate store
    security: Checking if certificate is in Deployment permanent certificate store
    basic: Removed progress listener: null
    Exception in thread "thread...

  • My Applet start failed due to security warning after upgrading java version

    Hi Team,
    We have an application where we read the weight from the attached weighing Scale (Hardware device).
    For this we use one Applet which runs and reads the data.
    Now we upgraded the Java version from 1.6 to 1.7 and started encountering a security alert 'Running unsigned applications like this will be blocked in a future release because it is potentially unsafe and a security risk'.
    Our application runs on a HTP port not on HTTPS because this is installed in client premise and no risk in opening HTTP port internally.
    Could you please help us in resolving the issue. We don't want to see the alert even after upgrading the Java version.
    Thanks,
    Vijay G

    Turn off your phone > connect it to a wall charger for 30minutes > install SUS > use SUS to update/repair your phone
    Update Service (SUS)
    PC Companion (PCC)
    Bridge (for Mac)
    Alternatives on How to backup Xperias
    http://talk.sonymobile.com/thread/36355
    "I'd rather be hated for who I am, than loved for who I am not." Kurt Cobain (1967-1994)

  • Applet keeps failing, please help!

    Why won't this code run as an applet in a web page?
    my HTML code goes as follows (very simple just want it to show the applet)
    <html>
    <body>
    <applet code="Main.class" width="450" height="450">
    </applet>
    </body>
    </html>
    import javax.swing.*;
    import java.applet.Applet;
    import java.awt.Color;
    import java.awt.event.*;
    public class Main extends JPanel
                            implements ActionListener {
        protected JButton b1, b2; //Add 3 JButtons to be used throughout the whole class
        protected JLabel l1, l2, l3; //add 3 labels to be used throughout the class
        public Main() {
            b1 = new JButton("vote Yes"); //Sets b1 (from protected) to Vote No
            b1.setMnemonic(KeyEvent.VK_D);
            b1.setActionCommand("yes");
            b2 = new JButton("Vote No"); //Sets b2 (from protected) to Vote No
            b2.setMnemonic(KeyEvent.VK_E);
            b2.setActionCommand("no");
            l1 = new JLabel("0");
            l2 = new JLabel("0");
            l3 = new JLabel("Votes (yes/no) :");
            //Listen for actions on buttons 1  and  2 (under).
            b1.addActionListener(this);
            b2.addActionListener(this);
            b1.setToolTipText("Click this button to vote yes.");
            b2.setToolTipText("Click this button to vote no.");
            //Adds the buttons and labels to the container (similar to the content in javax.swing that i posted earlier).
            add(b1);
            add(b2);
            add(l3);
            add(l1);
            add(l2);
        public void actionPerformed(ActionEvent e) {
            if ("yes".equals(e.getActionCommand())) {
                 l1.setText("1");
                 b1.setEnabled(false);
                 b2.setEnabled(false);
                 System.out.println("Thankyou for Voting!");
            } else if ("no".equals(e.getActionCommand())) {
                l2.setText("1");
                b2.setEnabled(false);
                b1.setEnabled(false);
         * Creates the GUI that the user will interact with.
         * the first block sets up the window
         * the second block adds a new content pane
         * the third block sets the frame to visible, and packs the frame.
        private static void createAndShowGUI() {
             //block 1
            JFrame frame = new JFrame("ButtonDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //block 2
            Main newContentPane = new Main();
            newContentPane.setOpaque(true);
            frame.setContentPane(newContentPane);
            //block 3
            frame.pack();
            frame.setVisible(true);
        public class main extends Applet {
              * This runs everything, this is the MAIN method
              * here is where you add you're "Create And Show GUI" method to run the GUI.
                public void run() {
                    createAndShowGUI(); //Create And Show GUI Method
        }

    I'd suggest:
    Move createAndShowGUI into the "main" class. Rename the method "main" with the argument list "String[] argv", that is, make it a real main method.
    Rename the "main" class AppWrapper. That's what it is, and having two classes whose names differ only in case is stupid. Get rid of the run() method. It actually does nothing as it is now.
    Rename the Main class to something that expresses what it actually does.
    Move the AppWrapper to a new, top-level class. Correct indentation while you're at it.
    Decide whether you want an Applet or a JApplet. The rest of this assumes you want a JApplet.
    Stop importing Applet. Start importing JApplet.
    Write a new class called AppletWrapper. Make this class extend JApplet.
    Change your HTML to use the class AppletWrapper.
    Make your AppetWrapper instantiate the Main class (or whatever you've renamed it to), and add it to itself. You can do this in the constructor, or preferably in the init() method.
    I think that'll be sufficient.

  • Second applet load fails

    This problem is reproducible always.
    I am using the Java Plug-in 1.5.0_10 in Windows XP Pro.
    If you set the Java Runtime Parameters in the Java Applet Runtime Settings tab (Start->Control Panel->Java, Java tab) as follows:
    -xms256m -xmx512m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
    Then visit this page in FireFox: http://java.sun.com/products/plugin/1.4.1/demos/applets/Animator/example3.html
    And then bring up an Internet Explorer (6.0.2900.2180) page to the same URL, the IE browser simply disappears.
    If you change the Java Runtime Parameters settings to simply:
    -xms256m -xmx512m
    Then both browsers load okay.
    This works in the converse, too. Start IE first, load URL and then start FireFox and FireFox will vanish.
    There appears to be some kind of problem when specifying Runtime Settings:
    -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
    I run with the debug settings to allow me to debug remotely from my IDE.
    Any help would be appreciated.

    This seems to occur on firefox 1.0.x, but not on 1.5.x.

Maybe you are looking for

  • Occasional Blue Screen of Death when syncing!

    I have a Lenovo Laptop...T500...sometimes when I sync my iPad it will error out with the BSOD with an "IRQ Not Less than..." error or somthing like that. What I noted was that it usually happens if I am transferring purchases one way or the other...l

  • Approve Button not visible in Tasks for Leave request in Tasks- MSS

    Dear gurus, Approve Button not visible in Tasks for Leave request in Tasks- MSS, anything missing on config end???? Any suggestions.... regards, Rajasekar.

  • I am switching from IBM to Apple

    I am switching form IBM to Apple. How do I get my Photoshop and Lightroom to work?

  • County Code in UI forms

    Hi All If some of you have been working on the Tax reports and especially the UI forms, you might have noticed the forms have a field/position for the 'COUNT OF MOST USED COUNTY CODE ' and 'COUNT OF LESSER USED COUNTY CODE '. This basically has the v

  • ABAP Debugger: assign user to external breakpoint

    Hi, when I assign different users to an external breakpoint the program still stops when it is executed with the "original" user which is not assigned to the BP anymore. Has anybody any solution for this behavior? The procedure I use is the following