1 Attachment(s)
Cannot see the gui for the SingleLaneBridge java applet example
Hi,
Note: To see a clearer version of the question asked below, please go to http://stackoverflow.com/questions/3...applet-example
I went to the this java site -> http://www.doc.ic.ac.uk/~jnm/book/bo...aneBridge.html and loaded the files in a new project in netbeans 6.8 . I removed the package declaration and put them in the default package of the project. I tried to compile it by right clicking and selecting run(Shift + F6) on the SingleLaneBridge.java file. This program compiled without errors.
This is what I got :
see [pqh3k.jpg (18.6 KB)]
Then I tried another method, which included copying the java files to a folder and compiled them manually using commandLine. Then made an html file and put the reference to the SingleLaneBridge.class file. Still I got a similar grey screen with the buttons. Then I tried again by downloading the pictures and the sound file (Note: All this time images and the sound file were called from the website):
1)Red car
2)Blue car
3)Bridge
4)Crash sound file
Then I put the images in the folder where the notepad files were. The image and sound path(s) was set appropriately in the BridgeCanvas.java file so dont worry about that.
After this I tried it out in Eclipse as well. But the same gray applet window with buttons showed up.
I would like to see the cars and bridge in the applet, like in this site -> http://www.doc.ic.ac.uk/~jnm/book/bo...aneBridge.html.
Thanks for your time.
Tlna
Re: Cannot see the gui for the SingleLaneBridge java applet example
Have you checked the console for error messages, exceptions etc.?
Re: Cannot see the gui for the SingleLaneBridge java applet example
Quote:
Originally Posted by
keang
Have you checked the console for error messages, exceptions etc.?
This program compiled without errors.
Any other opinions
Re: Cannot see the gui for the SingleLaneBridge java applet example
Where Do you have the 3 images and the sound file for the applet?
Re: Cannot see the gui for the SingleLaneBridge java applet example
Quote:
Originally Posted by
Norm
Where Do you have the 3 images and the sound file for the applet?
Well when I tried in netbeans 6.8 and Eclipse also as you know already:
1) Netbeans 6.8 - it was in the src folder (this src folder is inside the SingleLaneBridge folder)
2) Eclipse - I put it in the SingleLaneBridge folder not the src folder
I have tried programs which use images before (i mean java application programs). So far I have developed only java applications not applets. In those application programs the image things work.
SideNote: Someone from another forum suggested to put the same images in all the folders and see if it appears. I did this too but it failed.
------------------------------------------------------------------------------------------------------------------------------
OK SINCE YOU ASKED I NOW I TRIED IN ECLIPSE PUTTING THE IMAGES IN EACH FOLDER AND GUESS WHAT
*****************************IT WORKED*************************************
OK here is what I found:
Mistake:
Code:
redCar = controller.getImage(controller.getDocumentBase(), "/redcar.gif");
Corrected one:
It should be (without the / slash within the double quotes- alternatively you can give the path if you like)
Code:
redCar = controller.getImage(controller.getDocumentBase(), "redcar.gif");
Thank you once again NORM.
Hope this benefits anyone as silly as me (:-)).
Thanks
Re: Cannot see the gui for the SingleLaneBridge java applet example
Maybe next time I ought to post the code section when asking a question.