simpleapplet.java

来自「Java the UML Way 书中所有源码」· Java 代码 · 共 23 行

JAVA
23
字号
/*
 * SimpleApplet.java  V.H & E.L. 2001-08-10 
 */

import java.awt.*;
import javax.swing.*;

public class SimpleApplet extends JApplet {
  public void init() {
    Container content = getContentPane();
    Drawing aDrawing = new Drawing();
    content.add(aDrawing);
  }
}

class Drawing extends JPanel {
  public void paintComponent(Graphics window) {
    super.paintComponent(window);  // Remember this!
    setBackground(Color.green);
    window.drawString("Hello hello", 50, 50);
    window.drawOval(40, 30, 100, 40);
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?