嵌入Java小程序到.html文件 [英] Embedding Java Applet into .html file
问题描述
我无法嵌入我的小程序到网页。我不认为我做是正确的。
的 * 的我在同一个目录下我的HTML文件作为我的.class文件
我的主要方法是在CardApp类
这是我的html code
< HTML和GT;
< HEAD>
<元CONTENT =text / html的;字符集= ISO-8859-1
HTTP的当量=内涵式>
<标题> TestJCardBet.html< /标题>
< /头>
<身体GT;
<小程序codeBase类=code =CardApp.classHEIGHT =400WIDTH =500>< /小程序>
< /身体GT;
< / HTML>
制作小程序在广泛的浏览器的工作是令人惊讶的努力。该标签未正确规范的初期,因此Internet Explorer和Mozilla去不同方向。
Sun开发一个通用的JavaScript来处理所有的浏览器特定的怪癖,这样你就不必担心浏览器的兼容性。
添加到您的< HEAD>
部分:
&LT;脚本的src =// www.java.com/js/deployJava.js\"></script>
和这&LT;身体GT;
部分:
&LT;脚本&GT;
VAR属性= {codeBase的:HTTP://my.url/my/path/to/$c$cbase',
code:'my.main.Applet.class',
档案:我-archive.jar',
宽度:'800',
高度:'600'};
VAR参数= {java_arguments:-Xmx256m'}; //按您的需求定制
VAR的版本='1.5'; // JDK版本
deployJava.runApplet(属性,参数,版本);
&LT; / SCRIPT&GT;
请参阅 Java™的富互联网应用程序的部署建议进行了详细剧本和所有可能的选项的说明。
I am having trouble embedding my applet into a webpage. I don't think I'm doing it correctly.
* I have my html file in the same directory as my .class files
My main method is in CardApp class
This is my html code
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>TestJCardBet.html</title>
</head>
<body>
<applet codebase="" code="CardApp.class" height="400" width="500"></applet>
</body>
</html>
Making applets work across a wide range of browsers is surprisingly hard. The tags weren't properly standardized in the early days, so Internet Explorer and Mozilla went separate directions.
Sun developed a generic JavaScript to handle all the specific browser quirks, so that you don't have to worry about browser compatibility.
Add this to your <head>
section:
<script src="//www.java.com/js/deployJava.js"></script>
And this to <body>
section:
<script>
var attributes = {codebase: 'http://my.url/my/path/to/codebase',
code: 'my.main.Applet.class',
archive: 'my-archive.jar',
width: '800',
height: '600'};
var parameters = {java_arguments: '-Xmx256m'}; // customize per your needs
var version = '1.5'; // JDK version
deployJava.runApplet(attributes, parameters, version);
</script>
See Java™ Rich Internet Applications Deployment Advice for a detailed explanation of the script and all the possible options.
这篇关于嵌入Java小程序到.html文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!