小程序没有 运行

Applet not running

我对 java 和小程序相当陌生,但是当我 运行 我的代码时,我希望收到某种小程序 window 但是当我 运行.我做错了什么,或者我错过了什么?

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){

    }

}

作为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).

如果您 Java 8 或之前安装了必要的文件。你可以试试appletviewer