exercise14_11.java

来自「Introduction to java programming 一书中所有编程」· Java 代码 · 共 32 行

JAVA
32
字号
// Exercise14_11.java: Simulate a running fan
import javax.swing.*;
import java.awt.*;

public class Exercise14_11 extends JApplet {
  private FanControl fanControl = new FanControl();

  public void init() {
    getContentPane().add(fanControl);
  }

  // Main method
  public static void main(String[] args) {
    // Create a frame
    JFrame frame = new JFrame("Exercise14_11");

    // Create an instance of the applet
    Exercise14_11 applet = new Exercise14_11();

    // Add the applet instance to the frame
    frame.getContentPane().add(applet, BorderLayout.CENTER);

    // Invoke init() and start()
    applet.init();
    applet.start();

    // Display the frame
    frame.pack();
    frame.setVisible(true);
  }
}

⌨️ 快捷键说明

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