?? applet1.java~8~
字號:
package vector;import java.awt.*;import java.awt.event.*;import java.applet.*;import java.util.Vector;public class Applet1 extends Applet { private Vector xVector; private Vector yVector; boolean isStandalone = false; /**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 Applet1() { } /**Initialize the applet*/ public void init() { xVector = new Vector(360); yVector = new Vector(360); double x,y; Double xObject,yObject; for(int i = 0;i<360;i++){ x = -1.8+0.01*i; y = Math.exp(x); xObject = new Double(x*20+50); yObject = new Double(y*50+100); xVector.addElement(xObject); yVector.addElement(yObject); } try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } public void paint(Graphics g){ int x1,y1,x2,y2; for(int i=0;i<360;i++){ x1=((Double)xVector.elementAt(i)).intValue(); y1=((Double)yVector.elementAt(i)).intValue(); x2=((Double)xVector.elementAt(i+1)).intValue() ; y2=((Double)yVector.elementAt(i+1)).intValue() ; g.drawLine(x1,y1,x2,y2); } } /**Component initialization*/ private void jbInit() throws Exception { } /**Get Applet information*/ public String getAppletInfo() { return "Applet Information"; } /**Get parameter info*/ public String[][] getParameterInfo() { return null; }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -