Applet Displays in Appletviewer but not on Web Page?

My applet appears and functions fine when I view it under applet viewer. However, when I try to open and view the applet on a html page that includes it, nothing displays. Can someone help me out?
Class of Applet:
import java.awt.*;
import javax.swing.*;
import java.util.*;
public class PeteApplet extends JApplet
          PetePanel pete;
          public void init()
                    pete = new PetePanel();
                    this.setSize(452,146);
                    JPanel pane = new JPanel();
                    pane.setLayout(new GridLayout(1,1,15,15));
                    pane.add(pete);
                    this.setContentPane(pane);
                    this.setVisible(true);     
HTML Code:
<HTML>
     <HEAD>
          <TITLE>Java 21 Days - Day 13 Exercise 1</TITLE>
     </HEAD>
     <BODY BGCOLOR="WHITE">
     <APPLET CODE="PeteApplet.class" height="146" width="452">
     This applet requires a Java-enabled browser.
     </APPLET>
     </BODY>
</HTML>

which browser are u using ?? try netscape and see if u get the same error

Similar Messages

  • Applet works in appletviewer but not in IE - Applet notinited

    Hi, i have written a simple applet which uses swing components, ie swing labels and buttons. The buttons and labels also have icons with the text. The icons are in a folder called "icons" inside the same folder that the class is in. Everything works fine in the appletviewer, the icons are all displayed correctly, however when i try to open it through Internet Explorer i get this error in the java console window:
    Java(TM) Plug-in: Version 1.4.0
    Using JRE version 1.4.0 Java HotSpot(TM) Client VM
    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 properties
    t: dump thread list
    x: clear classloader cache
    0-5: set trace level to <n>
    java.security.AccessControlException: access denied (java.io.FilePermission icons/world.jpg read)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
         at java.security.AccessController.checkPermission(AccessController.java:401)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
         at java.lang.SecurityManager.checkRead(SecurityManager.java:887)
         at sun.awt.SunToolkit.getImageFromHash(SunToolkit.java:408)
         at sun.awt.SunToolkit.getImage(SunToolkit.java:422)
         at javax.swing.ImageIcon.<init>(ImageIcon.java:81)
         at javax.swing.ImageIcon.<init>(ImageIcon.java:107)
         at atm.init(atm.java:23)
         at sun.applet.AppletPanel.run(AppletPanel.java:341)
         at java.lang.Thread.run(Thread.java:536)
    Can anyone help me with this problem? I desperately need this applet working in the browser and not just the appletviewer.
    Many thanks in advance,
    Adrian

    Hi, i don't think it is a problem with the security settings, the problem definately lies in these lines
    inside the init method:
         Icon worldIcon = new ImageIcon(getDocumentBase(),"icons/world.jpg");
         JLabel myIconLbl = new JLabel("My Icon and Label", worldIcon, SwingConstants.CENTER);     
    add(myIconLbl);
    If i take the ' getDocumentBase() ' part out of the first line, the applet compiles and the worldIcon is correctly displayed in the appletviewer but not in Internet Explorer (the problem i orriginally sited).
    However by leaving the getDocumentBase() line in the code, the applet correctly compiles but does not show the icons at all in either appletviewer or IE!!
    Any suggestions?
    Adrian

  • Applet works on appletviewer but not browser

    Hi,
    I have just started using Java. I'm so new the only program I've tried to compile and run is "Hello World". I'm already having problems running the applet. I'm using Java 2 SDK on Windows 2000. The applet works just fine on appletviewer, but I can't get it to work on Netscape or MS Internet Explorer. What am I missing?

    posting stuff like the error message you get, and a section of the html page might help.

  • Mac 10.6.3 with Firefox 4.0.1: Can print from Word, PDF, Screen Shots, etc.--but not a web page. My Canon MP610 shows correctly as default printer.

    If I use AOL's browser, I can print Web pages. But not from Firefox. Could be this problem began with upgrade to your 4.0.1.

    If I use AOL's browser, I can print Web pages. But not from Firefox. Could be this problem began with upgrade to your 4.0.1.

  • My applet works in the appletviewer but not in the navigator

    My applet works in the appletviewer but not in the navigator
    exceptions problem1 and problem2 are throwed
    this is my code
    import java.applet.*;
    import java.net.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ValiderHtml extends Applet implements ActionListener {
    JButton send =new JButton("Connexion");
    JScrollPane jscrollpane= new JScrollPane();
    DefaultListModel lignes=new DefaultListModel();
    JList lstURL = new JList(lignes);
    BufferedReader reader = null;
    String ligne;
    URL url;
    URLConnection conn;
       public void init(){   
       this.setSize(900,400);
       setLayout( new GridLayout(2,1));
       jscrollpane.setBounds(new Rectangle(19,53,160,73));
       jscrollpane.getViewport().add(lstURL,null);
       send.addActionListener(this);
            this.add(send);
       this.add(jscrollpane);
        public void actionPerformed(ActionEvent evt) {
             Send();
       public void Send(){
            try {
       url=new URL("http://www.developpez.com");
       conn = url.openConnection();
       reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    while ((ligne = reader.readLine()) != null) {
                     lignes.addElement(ligne);
        }//fin bloc try
       catch (Exception e) {
                   lignes.addElement("probleme1");     
                finally{
                   try{reader.close();}catch(Exception e){ lignes.addElement("probleme2");}
       }// fin Send
          public void paint(Graphics g) {
                super.paint(g);
    }// fin Applet

    As for tracking the source of your problem your applet sucks.
    Try e.printStackTrace() on a cought exception and check the (full) trace.
    url=new URL("http://www.developpez.com");
    Unless yor applet is on www.developpez.com this will throw an exception in an unsigned
    applet without special policies.
    Signing applets:
    http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
    second post and last post for the java class file
    http://forum.java.sun.com/thread.jsp?forum=63&thread=409341
    4th post explaining how to set up your own policy with your own keystore

  • Midi synthesizer applet working with appletviewer , but no in IE browser

    Hi ,
    The following code works OK using appletviewer , but not working with IE browser . The user can play notes from C to G , using the corresponding keyboard keys (only when typing small A,B,C,D,E,F or G , a corresponding midi note would be produced) .
    When running it using appletviewer , the notes are being heard ;
    this isn't the case when running the applet using IE browser (after removing the security warning (of showing active content) - here , the applet simply doesn't respond to the key events .
    The code is :
    import java.awt.event.*;
    import javax.swing.*;
    import javax.sound.midi.*;
    public class RandomNotes extends JApplet implements KeyListener
         private MidiChannel midiChannel;
         private int note ;
         private long timeWhilePress;
         private long timeAfterPress;
         private int firstTime = 0;
         public void start()
              try
                   Synthesizer synthesizer = MidiSystem.getSynthesizer();
                      synthesizer.open();
                  midiChannel = synthesizer.getChannels()[0];
              catch(Exception ex)
                   ex.printStackTrace();
              addKeyListener(this);
         public void keyPressed(KeyEvent e)
              firstTime++;
              switch (e.getKeyChar())
                   case 'c':
                        note = 60;
                        break;
                   case 'd':
                        note = 62;
                        break;
                   case 'e':
                        note = 64;
                        break;
                   case 'f':
                        note = 65;
                        break;
                   case 'g':
                        note = 67;
                        break;
                   case 'a':
                        note = 69;
                        break;
                   case 'b':
                        note = 71;
                        break;
                   default:
                        note = -1;
                        break;
              timeWhilePress = System.currentTimeMillis();
              if (firstTime == 1)
                   midiChannel.noteOn(note, 127);
         public void keyReleased(KeyEvent e)
              timeAfterPress = System.currentTimeMillis();
             try
                   Thread.currentThread().sleep(timeAfterPress - timeWhilePress);
              catch (InterruptedException exception)
                   exception.printStackTrace();     
            midiChannel.noteOff(note);
            firstTime = 0;
         public void keyTyped(KeyEvent e)
    }Why it runs OK using appletviewer and not under IE browser , and how can I correct the problem please , so under IE browser , the applet should respond to key events ?
    Thanks in advance ,
    Lior .

    The problem is related to the Midi itself , not to the keyPressed event - I've just checked it :
    If I add a JOptionPane.showMessageDialog(null,"Lior"); statement
    as the first line of the keyPressed method ,
    then also when running the applet under IE browser , when clicking on any letter character (eg. "j") , I see the "Lior" message appears on screen . So the problem is not with the keyboard event handling , but something related to the Midi itself .
    If you don't mind , I should post this question also in the Java sound forum (unless this is considered a crosspost , then I'll not do that) .
    Thanks in advance ,
    Lior .

  • Does anyone know why my ipod nano sixth generation is displayed in windows but not itunes? I followed all the suggestions but nothing

    does anyone know why my ipod nano sixth generation is displayed in windows but not itunes? I followed all the suggestions but nothing.
    I apologize if I write bad but I'm Italian

    Doublechecking. Have you also tried a complete uninstall of both iTunes and all the other related software components and then a reinstall? If not, try the instructions from the following document:
    Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8

  • WCS is initialized, but is not serving web pages.

    The WCS version 5.0 failed to start, I tried stop the services and then reload the server but the resut is same.
    The dadabase is running and Apache server is running but  WCS is initialized, but is not serving web pages.
    CISCO say this issue coul be for syncronization.

    Hi,
    Cisco says it could be synchornization with the database.
    The log file show:
    172.28.255.113 - - [14/Nov/2010:00:02:18 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 3368
    172.28.255.111 - - [14/Nov/2010:00:04:30 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 3368
    172.28.255.113 - - [14/Nov/2010:00:07:17 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 3368
    172.28.255.111 - - [14/Nov/2010:00:09:30 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 3368
    172.28.255.113 - - [14/Nov/2010:00:12:17 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 3368
    172.28.255.111 - - [14/Nov/2010:00:14:30 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 3368
    172.28.255.113 - - [14/Nov/2010:00:17:17 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 3368
    172.28.255.111 - - [14/Nov/2010:00:19:31 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 3368
    172.28.255.113 - - [14/Nov/2010:00:22:17 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 3368
    172.28.255.111 - - [14/Nov/2010:00:24:31 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 3368
    172.28.255.113 - - [14/Nov/2010:00:27:17 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 3368
    172.28.255.111 - - [14/Nov/2010:00:29:31 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 3368
    172.28.255.113 - - [14/Nov/2010:00:32:17 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 3368
    172.28.255.111 - - [14/Nov/2010:00:34:31 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 3368
    172.28.255.113 - - [14/Nov/2010:00:37:17 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 3368
    172.28.255.111 - - [14/Nov/2010:00:39:31 -0500] "GET /webacs/loginAction.do?requestUrl=/webacs/welcomeAction.do HTTP/1.1" 500 33
    Thanks for your help.

  • I have an ipad  and a iphone 5, when i start find mi iphone from the ipad or in the iphone only display the iphone, but not mi ipad it displays with conection, ubication not avaliable, i configure the same apple id in bot devices, and a diferent apple id

    i have an ipad  and a iphone 5, when i start find mi iphone from the ipad or in the iphone only display the iphone, but not mi ipad it displays with conection, ubication not avaliable, i configure the same apple id in bot devices, and a diferent apple id, can help me?

    IOS: using facetime http://support.apple.com/kb/ht4319
    using an ipad will use the email address since you can't make a phone call.  see the link.
    Your basically calling/emailing yourself that's why your getting a busy signal.

  • How can I display XSLT transformer errors on a web page ?

    Hi,
    I have some JSP pages that access DB, create an XML based on DB data and then transform it into HTML through an XSLT stylesheet. Developing the XSL code it's easy to make mistakes and generate errors on trasformation, but what I receive on the web page is only a "Could not compile stylesheet" TransformerConfigurationException, while the real cause of the error is displayed only on tomcat logs. This is the code for transformation:
    static public void applyXSLT(Document docXML, InputStream isXSL, PrintWriter pw) throws TransformerException, Exception {
            // instantiate the TransformerFactory.
            TransformerFactory tFactory = TransformerFactory.newInstance();
            // creates an error listener
            XslErrorListener xel = new XslErrorListener();
            // sets the error listener for the factory
            tFactory.setErrorListener(xel);
            // generate the transformer
            Transformer transformer = tFactory.newTransformer(new SAXSource(new InputSource(isXSL)));
            // transforms the XML Source and sends the output to the HTTP response
            transformer.transform(new DOMSource(docXML), new StreamResult(pw));
    }If an exception is thrown during the execution of this code, its error message is displayed on the web page.
    This is the listener class:
    public class XslErrorListener implements ErrorListener {
        public XslErrorListener() {
        public void warning(TransformerException ex) {
            // logs on error log
            System.err.println("\n\nWarning on XEL: " + ex.getMessage());
        public void error(TransformerException ex) throws TransformerException {
            // logs on error log
            System.err.println("\n\nError on XEL: " + ex.getMessage());
            // and throws it
            throw ex;
        public void fatalError(TransformerException ex) throws TransformerException {
            // logs on error log
            System.err.println("\n\nFatal Error on XEL: " + ex.getMessage());
            // and throws it
            throw ex;
    }When I have an error in the XSL stylesheet (for examples a missing closing tag), I can find on tomcat logs the real cause of the error:
    [Fatal Error] :59:10: The element type "table" must be terminated by the matching end-tag "</table>".
    Error on XEL: The element type "table" must be terminated by the matching end-tag "</table>".but on my web page is reported just the TransformerConfigurationException message that is:
    "Could not compile stylesheet".
    How can I display the real cause of the error directly on the web page?
    Thanks,
    Andrea

    This code is part of a bigger project that let developers edit XSL stylesheets through a file upload on the system and we can't impose the use of any tool for checking the xsl. So, I need to display the transformer error on the web page.I see. This code is part of an editorial/developmental tool for developers to create and edit XSL stylesheets.
    As part of the editorial process, XSL errors during editing can be considered a normal condition. In other words, it is normal to expect that the developers will generate XSL errors as they are developing stylesheets.
    In this light, handling the XSL transformation errors is a business requirement that you need to handle. Using the Java Exceptions mechanisms, e.g. try / catch are inappropriate to handle business requirements, in my opinion.
    I suggest that you look at how you handle the occurence of XSL errors differently than what you currently have. You need to:
    (1) capture the Transformation exception on the server;
    (2) extract the message from the exception and put it into a message that can be easily understood by the user;
    The current error message that you have going to the web browser is not useful.
    And you should not have the Transformation exception sent to the web browser either.
    What you are attempting to do with the exception is not appropriate.
    Handle the Transformation exception on the Business tier and use it to create a useful message that is then sent to the Presentation tier. In other words, do not send Java exceptions to web browser.
    />

  • Display customers by Type on a web page

    I can find any module for displaying customers by type on a web page.
    The intention was to have customers entered under a specific Type, and then under a secure zone display them based on the customer type.
    Anyon know how this can be done?
    Thanks

    I have been working with BC (since Good Barry) for years and have had a few clients request the option for their members to create public profiles, so similar situation to what you are talking about.  One workaround I have used is having the clients enter their CRM details first (in my case after they subscribe to a secure zone) and then directing them immediately to a page with the Web App Submission form. THAT form can then be pre-populated with the newly saved customer's CRM details using secure zone modules (E.g {module_workphone}, {module_workaddress} etc..). It is not ideal, but reasonably seamless from the client's point of view, as you can populate the form with hidden or read-only fields, meaning they don't have to enter their details twice.
    Question for you, Mario - the problem I have always had is that obviously there comes a time when the client wants to update their profile and/or their details on file.  I noticed that the EDIT layout of the webapps will NOT populate fields with the CRM modules - setting the values of the fields to {module_whatever} just won't work, as simple as it sounds..  So every time a client wants to (for example) UPDATE their contact details, they have to do it twice (once for the "Update Details" form and once for the "Profile Web App"). 
    Is there ANY way around this?

  • Firefox will not load web page (I also have Internet Explorer 8 installed).

    Fire Fox will not load web pages. It may have something to do with proxy settings but I have reset this to Auto-Detect which is where it has always been in the past but still nothing. Something has reset my proxy settings in the past which caused a similar problem but doesn't seem to be the issue this time. I have Internet Explorer 8.0 installed on computer right now and it seems to work.

    After looking into this further I checked firewall settings in Panda A.V. For Firefox they were set to Custom settings which effectively disabled it. I changed setting to Outbound only like Internet Explorer and other programs and Firefox seems to work fine now. Hope this helps others who have experienced this problem. I have teenage children who use computer a lot (Face Book, etc.) so the root of the problem may have been Malware, Adware, or something else but hopefully Panda has taken care of this.

  • Will not show web page on windows high contrast

    Hi,
    Am running Windows 7 64bit
    my problem is as follows.
    I normally run Windows in high contrast mode and would prefer all web sites to be on the dark side.
    Occasionally I need to be able to see a web page as its designers intended it to be.
    So I want to have the text white and background black and then the ability to toggle between that and the web page's own colour scheme.
    Thought I'd found exactly what I needed in the add-on "Toggle Document Colors 1.0"
    Am presuming it toggles the status of the "Allow pages to choose their own colours..." tick box.
    This setting seems to get lost when FF closes. Even if I set the tick box myself and then close FF it is gone when I reopen FF.
    If the box is ticked and a page refreshed it still does not show web page colours ?
    Without any addons at all after a reset and only using the colours dialog I cannot get it to behave.
    If you start in Windows white mode (normal) things are better even after FF close. Change to Windows black mode (high contrast) things start off ok then after you close FF it will not work
    If there is a solution I would love to know it.
    Will settle for a workaround.
    Considered using old version of FF, but this is not really a good idea.
    Really don't want to go back to IE
    in hope ... Bob

    iTunes does not yet support Windows 8, so there may not be a fix until such time as Apple releases a version of iTunes that does support 8. You can search this forum for "windows 8", though, and perhaps you'll find a suggestion in one of the other threads on the issue.
    Regards.

  • My iPhone 3gs is not able to connect through internet. I have a Airtel wireless at home.Phone connects through wireless but not opens any page or itune or apllications

    My iPhone 3gs is not able to connect through internet. I have a Airtel wireless at home.Phone connects through wireless but not opens any page or itune or applications.

    Hi,
    can you provide a bit more detail, as can you use the 3G network to access the web, and what security is your wireless using?
    Regards
    Ryan

  • New tab will not open web page

    *error message when opening firefox= "Could not initialize the application's security component. The most likely cause is problems with files in your application's profile directory. Please check that this directory has no read/write restrictions and your hard disk is not full or close to full. It is recommended that you exit the application and fix the problem. If you continue to use this session, you might see incorrect application behaviour when accessing security features."
    *new tabs do not open web pages
    *plugin container.exe and updater.exe do not open or run

    Create a new profile as a test to check if your current profile is causing the problems.
    See "Basic Troubleshooting: Make a new profile":
    *https://support.mozilla.org/kb/Basic+Troubleshooting#w_8-make-a-new-profile
    If that new profile works then you can transfer some files from the old profile to that new profile, but be careful not to copy corrupted files.
    See:
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox
    Remove all rules for Firefox and the plugin-container from the permissions list in the firewall and let your firewall ask again for permission to get full unrestricted access to internet for Firefox and the plugin-container process and the updater process.
    See:
    *https://support.mozilla.org/kb/Server+not+found
    *https://support.mozilla.org/kb/Firewalls

Maybe you are looking for

  • How do I connect a Canon Selphy CP900 using the USB port on Time Capsule

    I am running a MacBook Pro with Mountain Lion (10.8.5) and have installed the CP 900 driver (6.2) supplied by Canon from their website.  I have a Time Capsule set up as a stand alone internal network at my home and use it as a network attched hard dr

  • Save your Unlimited. B4 you get rid of it read this.

    First, If you are going to get a new phone and you have unlimited you will lose the unlimited unless you pay full price for the phone or bring a phone you bought to Verizon. Lets be clear about that first because Verizon Employees might not tell you

  • Removing admin password form Access 2003 database front end and back end

    We have a legacy database that has been passed down from the original creator, who is no longer with the organization. It was created in Access 2003. It has a front end and a back end. The original admin password can not be located and we are in the

  • Unresolved column error

    I created a new physical that the exact same as another physical table i have. When i create a report and use my new table i get the below error when using this table. Can someone please hellp? View Display Error Odbc driver returned an error (SQLExe

  • Thumbnails are blank when opening a new tab.

    I have tried all the suggestions to get the graphics to show in the thumbnails when I open a new tab. Nothing changes. The panels are there for the thumbnail, the name of the website shows, but there is no graphic or "picture" of the page in the thum