Cannot see the gui for the SingleLaneBridge java applet example
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Cannot see the gui for the SingleLaneBridge java applet example

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Posts
    10

    Smile 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
    Attached Images Attached Images  
    Last edited by btap0644; June 25th, 2010 at 04:21 AM. Reason: Formatted text

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,474

    Re: Cannot see the gui for the SingleLaneBridge java applet example

    Have you checked the console for error messages, exceptions etc.?
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  3. #3
    Join Date
    Aug 2009
    Posts
    10

    Talking Re: Cannot see the gui for the SingleLaneBridge java applet example

    Quote Originally Posted by keang View Post
    Have you checked the console for error messages, exceptions etc.?
    This program compiled without errors.


    Any other opinions

  4. #4
    Join Date
    Jun 1999
    Location
    SW Missouri
    Posts
    3,448

    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?
    Norm

  5. #5
    Join Date
    Aug 2009
    Posts
    10

    Smile Re: Cannot see the gui for the SingleLaneBridge java applet example

    Quote Originally Posted by Norm View Post
    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

  6. #6
    Join Date
    Aug 2009
    Posts
    10

    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.

Tags for this Thread

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center