|
-
Sep 8th, 2006, 11:29 PM
#1
Thread Starter
PowerPoster
Java Applet
Hey....
I have created very simple Java Applet. Here the coding has done my-self.
This is the Java File.
import java.awt.Graphics;
public class HelloWorldApplet extends java.applet.Applet
{
public void paint(Graphics g)
{
g.drawString("Hello World",5,25);
}
}
This is HTML File.
<html>
<head>
<title>Hello To Everyone !</title>
</head>
<body>
<p>My Java Applet Says:
<applet code = "HelloWorldApplet.class" width=150 height=25></applet>
</p>
</body>
</html>
Then I used IE6.0 and Applet Viewer to run the applet. But it gives different outputs.
Output on IE6.0 and Applet Viewer as follws.
I’m confusing with that. Can someone help me to where I’m going wrong?
-
Sep 9th, 2006, 12:04 PM
#2
Re: Java Applet
Please use code tags whenever posting code.
I don't think IE supports the applet tag, or if it does, it might attempt to use the broken MS JVM.
Use the object tag with the correct classid instead.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 9th, 2006, 02:53 PM
#3
Re: Java Applet
You can Open Java Console from the IE page (Right click the Applet) and check if any errors occurred during run-time
EDIT: CornedBee is %100 right, you should use the Object tag
Last edited by ComputerJy; Sep 9th, 2006 at 02:56 PM.
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Sep 10th, 2006, 10:46 PM
#4
Thread Starter
PowerPoster
Re: Java Applet
 Originally Posted by CornedBee
Please use code tags whenever posting code.
I don't think IE supports the applet tag, or if it does, it might attempt to use the broken MS JVM.
Use the object tag with the correct classid instead.
Please can you explain this little.
Thanks
-
Sep 11th, 2006, 11:52 AM
#5
Re: Java Applet
Which part, the first or the second?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 11th, 2006, 03:10 PM
#6
Frenzied Member
Re: Java Applet
Look for a little mug of coffee in your taskbar. Right click and view the console. Any errors will be listed there.
PS: What about a screenshot of these differences... Applet tag has always worked for me (cross browser), so I'm not sure what kind of problems you're having.
-
Sep 11th, 2006, 03:12 PM
#7
Frenzied Member
Re: Java Applet
Sorry about that, you did post screenies.
It looks like IE doesn't have an updated JRE or something. Goto internet options and make sure the java checkbox is checked. If it is checked, then uncheck it and try again (make sure you check it back if this does not work).
-
Sep 11th, 2006, 08:10 PM
#8
Re: Java Applet
 Originally Posted by System_Error
Look for a little mug of coffee in your taskbar. Right click and view the console. Any errors will be listed there.
PS: What about a screenshot of these differences... Applet tag has always worked for me (cross browser), so I'm not sure what kind of problems you're having.
lol, looks like I was a little faster
 Originally Posted by System_Error
It looks like IE doesn't have an updated JRE or something. Goto internet options and make sure the java checkbox is checked. If it is checked, then uncheck it and try again (make sure you check it back if this does not work).
That's right, you can make sure java is enabled for any browser from the Java shortcut on the Control Panel
Java==>Advanced Tab==>Settings==> <Applet> tag support.
If you didn't have any of these you must re-install the JRE
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Sep 11th, 2006, 11:00 PM
#9
Thread Starter
PowerPoster
Re: Java Applet
 Originally Posted by CornedBee
Which part, the first or the second?
Second part, please
“victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha
-
Sep 12th, 2006, 07:49 AM
#10
Re: Java Applet
 Originally Posted by eranga262154
Second part, please
read this
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Sep 12th, 2006, 10:25 PM
#11
Thread Starter
PowerPoster
Re: Java Applet
 Originally Posted by ComputerJy
I go through your link,
But still comes with same output,
My output should be as follows.
My Java Applet Says: Hello World
That bold text should be printed on a dark area, isn't it? Still have the same output.
“victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha
-
Sep 13th, 2006, 06:40 AM
#12
Re: Java Applet
You can Open Java Console from the IE page (Right click the Applet) and check if any errors occurred during run-time
if you couldn't find out what is wrong, please show us the stack-trace of the Exception
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Sep 13th, 2006, 10:41 PM
#13
Thread Starter
PowerPoster
Re: Java Applet
OK,
holdon, I'll test it and send my response here. Thanks
“victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha
-
Oct 9th, 2006, 11:45 AM
#14
Lively Member
Re: Java Applet
It could be that your browser does not have legacy support. When you set attributes, they should be in quotes:
<applet code = "HelloWorldApplet.class" width="150" height="25"></applet>
Also, make sure that your setting your page color so that it draws in black (or whatever color you want).
Code:
g.setColor (Color.black);
g.drawString("Hello World",5,25);
It's good programming to set the color before you draw anything, even though it should draw in black by default. You may consider setting the background color before you draw to see if that even shows up when viewing from IE.
Code:
setBackground (Color.blue);
g.setColor (Color.black);
g.drawString("Hello World",5,25);
Last edited by lunchboxtheman; Oct 9th, 2006 at 11:55 AM.
-
Oct 9th, 2006, 12:00 PM
#15
Re: Java Applet
 Originally Posted by lunchboxtheman
It could be that your browser does not have legacy support. When you set attributes, they should be in quotes:
No you don't
 Originally Posted by lunchboxtheman
Also, make sure that your setting your page color so that it draws in black (or whatever color you want).
It's poor programming (Lack of efficiency) when you put unnecessary instructions in your code
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Oct 9th, 2006, 01:43 PM
#16
Lively Member
Re: Java Applet
 Originally Posted by ComputerJy
No you don't
It's poor programming (Lack of efficiency) when you put unnecessary instructions in your code
Welcome to the world of XHTML. Read up on it. Most browsers are phasing out HTML support, and the new standard is XHTML. It is considered good programming to put attributes in quotes, though in basic HTML it is NOT required. Make sure you know what your talking about before you post false information.
(It didn't quote your statement about my comments on quotes correctly)
-
Oct 9th, 2006, 01:55 PM
#17
Re: Java Applet
Perhaps, you'd go and read my post again.
About the XHTML I just said "No you don't", and you really don't have to write XHTML, HTML still works for all browsers
The Part you quoted was about the "setColor" which is totally unnecessary
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Oct 9th, 2006, 04:21 PM
#18
Re: Java Applet
 Originally Posted by lunchboxtheman
Welcome to the world of XHTML. Read up on it. Most browsers are phasing out HTML support, and the new standard is XHTML.
Browsers phasing out HTML? What planet do you live on? XHTML has huge acceptance issues. IE still, even in version 7, doesn't really support XHTML. XHTML 2, from what I'm seeing on the W3C html list, is in high risk of being stillborn. The W3C itself is being criticized by many professionals, and the WHAT-WG is busily writing a HTML 5 standard.
I give HTML another 10 years at least, unless virtual reality becomes the primary net form first.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 9th, 2006, 09:36 PM
#19
Thread Starter
PowerPoster
Re: Java Applet
 Originally Posted by lunchboxtheman
attributes, they should be in quotes:
<applet code = "HelloWorldApplet.class" width="150" height="25"></applet>
I try this, but not get fine output. I think misses the quotes is much effected to my code, isn't it?
“victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|