Results 1 to 5 of 5

Thread: OBJECT tag

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member GamerMax5's Avatar
    Join Date
    Nov 2004
    Location
    United States
    Posts
    388

    Question OBJECT tag

    I'm still having trouble grasping how this thing is supposed to work. I've read numerous tutorials on it and I'm still lost.

    I wrote a stupid applet that simply prints a string to the applet. I made a web page that uses the OBJECT tag to display it on the web page. Here is the code that I used:

    Code:
    <html>
    	<head>
    		<title>Keyboard Test Applet :: Written by Greg Martin</title>
    	</head>
    	<body>
    		<center>
    			<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#Version=1,4,0,0" width="640" height="480">
    				<param name="code" value="KeyboardTest.class">
    				<param name="codebase" value="html/">
    				<param name="type" value="application/x-java-applet;version=1.4">
    			</object>
    		</center>
    	</body>
    </html>
    This works all fine and dandy however the applet window keeps telling me that the applet failed to initialize. I might be missing something because of it's absolute simplicity but here is the code that I have in the applet:

    Code:
    import java.applet.*;
    import java.awt.*;
    
    public class KeyboardTest extends Applet {
    	public void init() {}
    
    	public void paint(Graphics g) {
    		g.drawString("Press a key...", 20, 20);
    	}
    }
    The KeyboardTest class file is located in the same directory that the web page is in so I don't see any problem there but I can't figure out what in the world is going on. Any help would be appreciated. Thanks in avance.

    EDIT: And yes I am aware that the class id for the version of Java is lower than what's available but I figured that since I used dynamic versioning, it'd find the more recent one until I figured out how to properly use the OBJECT tag.
    Last edited by GamerMax5; Aug 27th, 2007 at 11:56 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width