creating html file
I have created a html file to run my applet as follows:
<head><Title>Binary Search Tree</Title></head>
<Applet code=CopyBinaryTreeDisplay.class height=480 width=640>
Problem is, whenever I run this I only get the title and then a grey square, none of my GUI shows at all. I don't know where I am going wrong with this, if I run my CopyBinarySearchTreeDisplay.Java from within Eclipse IDE it shows perfectly in the applet viewer.
Can anyone help me out with this? Is it a setting on my PC, although other htmls which Eclipse generated for me work its just Eclipse no longer generates.
I also created my GUI via netbeans as a form and then had to convert it to an applet and copy the code to Eclipse - would this have any bearing on the problem?
Thanks very much.
Is the class file in the same directory as the html page ? if so, have your applet code
a package directrive ?
Thanks for the quick response.
Yeah, I created it in the same directory as the class file, which is C:\workspace\CopyofBinaryTreeSearch.
Not sure what your question means I've afraid? I don't know whar a package directive is, where would I look for this?
In the directory, if it helps, I have the following files listed:
CopyBinaryTreeAction.class and .java
CopyBinaryTreeDisplay.class and .java
CopyTreeNode.class and .java
look forward to hearing from you again
Also include in this in the applet tag
CODEBASE = "."
If there is, say a first line in your code like:
Then your class file should be in the directory 'project' under the directory where
your html file is and the tags class spec should be
code = "project.SomeClass.class"
But first you should check if your class file is found, the status bar should indicate
that. If your applet bugs out during the initiation process, it will say something like
"applet xxxx not initiated' you can check that by bringing up the java console, in IE
thats: Tools -> Sun Java Console
I have checked and my class has no project listed at the top.
When I run the html, it runs an applet and says done in the bottom left - so it looks as though it is working - although not picking up my clas file presumably, hence no display of buttons etc.. just a grey box?
Did you mean to go to Tools -> Sun Java Console from within Internet Explorer..? If so, I couldn't find this.
Thanks very much for your patience with me!
Oh ?, then you must in some way have removed/hidden it. Its the top bar in IE
with options; file, Edit, Favorites, Tools and Help.
Bring up the console, then enter your applet's URL.
To me this seems like a coding error of some sort.
Btw, does your applet implement the public void init() method ?
Thank you for still trying to help with this....
Yes, I am implementing the init method:
public void init()
btd = new CopyBinaryTreeAction();
btd.generateTree(); // call generateTree method from BinaryTreeAction to setup tree ready for paint
Would it help if I e-mailed you my classes and html file?
Yes, or u could just zip and attatch to a post here
PS: I'm not quite sure about this one:
It doesn't lool like something a regular applet would be able to do....
Last edited by sjalle; 07-25-2005 at 04:10 AM.
Might take that line out then...!
Have attached the zip file
I get this when i try to load it (is the Sun Java Console)
I added a package directive on top of each java source file.
This means that when compiled the class files are stored in folder "devx1"
under your source dir.
check the test here:
I put the html in top directory and made a devx1 directory under that for
the class files.
If you omit the package directive then just put the class files in same
folder as the html and leave out the dev1. prefix of the class file name in
the applet tag.
Last edited by sjalle; 07-25-2005 at 05:37 AM.
I tried the link but it just shows the grey box in the applet - is that what you see when you go to the link?
Nope, I see green buttons on left and bottom, and a paint area in center-right.
Have you tried IE restarting & refresh IE ? You may be looking at the cache.
still not happening..!
must be something on my computer?
I need to get the html to work at college as I want to check the size of the screen - to see if its OK for the pooled computers resolution.
If I take all the files I sent you to college and then run the html from there - in theory should this work? And then if not, I could try your suggestion on package setting?
Thanks very much for your patience and help with this!
If it doesn't work on your computer it must be that you have not set IE properly.
Click Tools->internet options and select the "advanced" tab. Search the list of
selections and select "Use Sun JRE", "Enable java Console" and "JIT compiler"
If that does not work then download and install the JRE from SUN
NOTE: Your class file name was wrong in your html
IF you try loading the URL i posted on one of your school's pcs it had better work
Last edited by sjalle; 07-25-2005 at 06:24 AM.
By ram_son in forum VB Classic
Last Post: 03-29-2005, 04:09 PM
By el__sid in forum VB Classic
Last Post: 03-01-2005, 03:42 AM
Last Post: 11-19-2002, 08:11 AM
By Sam in forum Architecture and Design
Last Post: 02-04-2001, 01:57 AM
Last Post: 02-02-2001, 10:22 AM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL