⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sinapplet.java

📁 介绍有关java的资料 课件 相当一本书籍 里面都是很基础的知识
💻 JAVA
字号:
import java.awt.*;import java.awt.event.*;import java.applet.*;import java.awt.Graphics;public class SinApplet extends Applet {  boolean isStandalone = false;  int Phase;  double f(double x) {    return (Math.sin(Phase + x/7) + 2) * size().height / 4;  }  /**Get a parameter value*/  public String getParameter(String key, String def) {    return isStandalone ? System.getProperty(key, def) :      (getParameter(key) != null ? getParameter(key) : def);  }  /**Construct the applet*/  public SinApplet() {  }  /**Initialize the applet*/  public void init() {    try {      Phase = Integer.parseInt(this.getParameter("Phase", "90"));    }    catch(Exception e) {      e.printStackTrace();    }  }  /**Get parameter info*/  public String[][] getParameterInfo() {    String[][] pinfo =      {      {"Phase", "int", "Phase"},      };    return pinfo;  }  public void paint(Graphics g) {    for (int x = 0 ; x < size().width ; x++) {      g.drawLine(x, (int)f(x), x + 1, (int)f(x + 1));    }  }}

⌨️ 快捷键说明

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