Applet未初始化
我已经在ubuntu18.04 LTS机器上安装了JDK8。我尝试在其他计算机上运行代码。工作正常我想知道如何配置applet浏览器。
HelloWorld.java
import java.applet.*;
import java.awt.*;
//Value passed through HTML
public class HelloWorld extends Applet{
int x, y, w, h;
public void init(){
x = Integer.parseInt(getParameter (" xValue ")); //start x coordinate
y = Integer.parseInt(getParameter (" yValue ")); // start y coordinate
w = Integer.parseInt(getParameter (" wValue ")); // width
h = Integer.parseInt(getParameter (" hValue ")); // height
}
public void paint( Graphics g ){
g.drawRect (x, y, w, h ); // Graphics written method
}
}
Hello.html
<html>
<body>
<applet code = "HelloWorld.class" width = "300" height = "300" >
<param name = xValue value = 20 >
<param name = yValue value = 40 >
<param name = wValue value = 100 >
<param name = hValue value = 50 >
</applet>
</body>
</html>
它应该产生一个applet,并以给定的xy坐标和给定的高度和宽度绘制一个矩形。