英文:
Applet not running
问题
我对Java和Applet相当新,但是当我运行我的代码时,我期望能看到某种Applet窗口,然而运行时什么都没有发生。我做错了什么,还是漏掉了什么?
import java.applet.Applet;
import java.awt.*;
public class Tennis extends Applet {
final int W = 700, H = 500;
public void init(){
this.resize(W,H);
}
public void paint (Graphics g){
g.setColor(Color.BLACK);
super.print(g);
}
public void update (Graphics g){
paint(g);
}
public static void main(String[] args){
}
}
英文:
Im fairly new to java and applet but when I run my code I expect to be greeted with some sort of applet window however nothing happens when I run. What am I doing wrong, or am I missing something ?
import java.applet.Applet;
import java.awt.*;
public class Tennis extends Applet {
final int W = 700, H = 500;
public void init(){
this.resize(W,H);
}
public void paint (Graphics g){
g.setColor(Color.BLACK);
super.print(g);
}
public void update (Graphics g){
paint(g);
}
public static void main(String[] args){
}
}
答案1
得分: 1
在过去的五年中,大多数浏览器供应商已经撤销了对诸如Flash、Silverlight和Java等插件的支持。在浏览器中支持Java小程序只有在浏览器供应商致力于支持基于标准的插件的情况下才可能。到2015年末,许多浏览器供应商已经删除或宣布了删除基于标准的插件支持的时间表,而一些浏览器则引入了专有的、特定于浏览器的扩展API。因此:
- Java SE 8中现有的小程序支持将持续到2019年3月,之后可能随时被删除。
- Oracle于2016年1月宣布将在Java SE 9中停用小程序,并在Java SE 11 (18.9)中将其移除。
如果您已安装了Java 8或更早版本,并且具有必要的文件,您可以尝试appletviewer。
英文:
> During the past five years, most browser vendors have withdrawn
> support for plugins such as Flash, Silverlight, and Java in their
> products. Supporting Java Applets in browsers was only possible as
> long as browser vendors were committed to supporting standards based
> plugins. By late 2015, many browser vendors had either removed or
> announced timelines for the removal of standards-based plugin support,
> while some introduced proprietary browser-specific extension APIs.
> Consequently:
>
> - Existing Applet support in Java SE 8 will continue through March 2019, after which it may be removed at any time.
> - Oracle announced in January 2016 that Applets would be deprecated in Java SE 9, and removed from Java SE 11 (18.9).
If you have Java 8 or prior installed with necessary files. You can try appletviewer
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论