permaculture playing cards*
The moose likes Beginning Java and the fly likes Gray box where my applet should be Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Gray box where my applet should be" Watch "Gray box where my applet should be" New topic
Author

Gray box where my applet should be

lee gardiner
Greenhorn

Joined: Feb 09, 2002
Posts: 3
I have developed the following program which allows the user to move a box around the screen. The surface of the box is painted with an image that changes upon every key press to give the impression of movement. This applet works fine in appletviewer but when i try to view it in a web browser such as IE it just comes up as a gray box. I know i have the html code right and the gif images are all in the same folder as the class file so this one has me puzzled. I would be very grateful if someone could look at my code and tell me where the problem is.
Many Thanks

[ May 30, 2002: Message edited by: Dirk Schreckmann ]
Keith Owen
Greenhorn

Joined: May 21, 2002
Posts: 19
It is most likely a problem with your HTML. Swing can be tricky when it comes to that. Would you care to post your HTML document, or at least the part that references your applet?
-Keith
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Perhaps your browser doesn't have support for Java beyond version 1.1.8 installed. You may need to install the Java plug-in. Get it here:
http://java.sun.com/getjava/
Any luck yet?


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Pradyumna Hari
Greenhorn

Joined: May 27, 2002
Posts: 15
Hi lee,
Please do post your html and the names of images used. I would be interested to analyse your program.
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2579

I also guess it's a problem with the JVM of your browser. What does Java Console show you? That should give you some idea abt the error.
- Manish
lee gardiner
Greenhorn

Joined: Feb 09, 2002
Posts: 3
Thanks for all your reply's as requested my html code is posted below. The names of my gif images are simply a1 to a6.

I have tried this in the latest version of netscape and explorer both show nothing but the gray box. I was thinking maybe some variables are not intialised but if this was the case why is it working in appletviewer. I have tried it on more than one pc, all giving the same results. I have also tried reducing the security settings on my browser to minimum to see if that has any affect, but it does not appear to have.
Again i am grateful for any advice you can give me.
Lee
[ May 31, 2002: Message edited by: Dirk Schreckmann ]
lee gardiner
Greenhorn

Joined: Feb 09, 2002
Posts: 3
Manish - Could you expand further upon what you where saying about the JVM and the Java Console. I have the latest version of Java, i think, and all my other applets display fine in web pages.
I feel a bit silly for asking this question but this is the beginner forum - what is the Java console and how do i access it. I just use dos to compile and edit my programs, is this what you mean by java console. The text books do a good job at teaching you the OOP principles but are not as good on the actual techology you use to run and compile your programs.
Thanks for any help.
Lee
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Originally posted by Dirk Schreckmann:
Perhaps your browser doesn't have support for Java beyond version 1.1.8 installed. You may need to install the Java plug-in. Get it here:
http://java.sun.com/getjava/
Any luck yet?
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
If you'd like to determine what version of Java your browsers are using, you could use this code to find out:
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2579

Originally posted by lee gardiner:
I feel a bit silly for asking this question but this is the beginner forum - what is the Java console and how do i access it. I just use dos to compile and edit my programs, is this what you mean by java console. The text books do a good job at teaching you the OOP principles but are not as good on the actual techology you use to run and compile your programs.
Lee

Hi Lee,
It's perfectly alright!
If you are using IE, you can see java console from "View" menu option -> Java Console. All your System.out.println() (if any) of applet are displayed here. Also, the exceptions are displayed here; which will give you an idea abt what's wrong with your code.
If you do not see "Java Console" option in your "View" menu of IE, you'll have to do - Tools |Internet Options |Advanced tab, under Microsoft VM, check "Java Console Enabled" and restart your browser. You should be able to see option "Java Console", in ur "View" menu now. You should also use the code that Dirk gave to determine the JVM of your browser. Though you may have the latest Java on ur machine, the JVM IE uses might be different. Let us know if it helps..
HTH,
- Manish
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Gray box where my applet should be