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

📄 show.java

📁 本程序用JAVA编制
💻 JAVA
字号:
package curve;import java.awt.*;import java.awt.event.*;import java.applet.*;import java.util.Vector;public class Show extends Applet {  Image bufferImage;  // 缓冲图像  Graphics bufferGC;  // 图形设备环境  curve c;            // 曲线对象  int graphWidth;     // 图形区域的宽度  int graphHeight;    // 图形区域的高度  Vector v;           // 统计数据矢量  Dimension d;  public Show() { }  public void init() {    setBackground(Color.white);    // 根据在 HTML 中指定的小程序大小来确定图形的大小    d=getSize();    graphHeight=d.height-50;    graphWidth =d.width-60;    // 创建图形的绘制环境    bufferImage=createImage(graphWidth,graphHeight);    bufferGC=bufferImage.getGraphics();    // 与绘制环境相关的曲线对象    c=new curve(bufferGC);    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  private void jbInit() throws Exception {}  // 使用 Curve 的方法开始绘制图像。  public void start(){    paintCurve("t","title");  }  // 绘制图像的内容  public void paint(Graphics g){    g.drawImage(bufferImage,20,5,this);    //g.drawString(this.paramString(),10,30);  }  // 使用Curve的方法--画曲线  public void paintCurve(String name,String title){    Vector actionVector=new Vector();    String actionString=new String();    actionVector=readData(name);    actionString=readStringData(title);    int xCount=actionVector.size();    float ytop=c.getMaxY(actionVector);    c.clearXHashMarks();    c.clearYHashMarks();    c.clearScreen();    c.getMaxY(actionVector);    c.drawAxes(graphWidth,graphHeight);    c.makeHashMarks(xCount,ytop); // x轴刻度数    c.showData(actionVector);    c.makeTitle(actionString);    repaint();  }  // 读取HTML数据参数到一个矢量对象,s代表程序控制的字符串(用于获取 HTML 的字符串)。  public Vector readData(String name){    Vector tempVector=new Vector();    Float param;    String tempData=null;    boolean datapresent=true;    int i=0;    while(datapresent){      try{        tempData=getParameter(name+Integer.toString(i+1));        //tempData=getParameter(getParamName(i+1));      }catch(Exception e){        System.out.println(e);      }      if (tempData==null){        datapresent=false;      }else{        param=Float.valueOf(tempData);        tempVector.addElement(param);        i+=1;      }    }    return tempVector;  }  // 读取HTML字符串数据(包含相关数据的简要描述)  public String readStringData(String title){    String tempString = null;    try{      tempString=getParameter(title);    }catch(Exception e){      System.out.println(e);    }    return tempString;  }}

⌨️ 快捷键说明

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