小程序未运行

huangapple go评论71阅读模式
英文:

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

Java客户端路线图更新

在过去的五年中,大多数浏览器供应商已经撤销了对诸如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

英文:

As Java Client Roadmap Update

> 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

huangapple
  • 本文由 发表于 2020年10月17日 10:46:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/64398532.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定