热门关键字:  ubuntu  分区  Fedora  linux系统进程  函数

当前位置 :| 主页>Linux教程>编程开发>JAVA>

JAVA 三次样条插值曲线

来源: 作者: 时间:2008-09-01 Tag: 点击:

import java.awt.*;
import java.awt.event.*;

public class ThreeInOne {
    public static void main(String args[]) {
        Three t = new Three();
        t.display();
    }
}

class _paint extends Panel implements ActionListener {
    public int p_count = 0, flag = 0;
    int point[][] = new int[100][2];
    double h[], ath[], c[], b[], d[], s2[], s1;
    double a[], rs[];

    int tempx, tempy;

    public _paint() {
        p_count = 0;
        this.addMouseListener(new IsMouseClicked());
    }

    
// /////////////////////////

    public void p_random() {
        Graphics g = getGraphics();
        g.setColor(Color.black);
        int i, set = 0, j, flag = 0;
        
// p_count=10;

        for (i = 0; i < 6; i++) {
            set = 0;
            while (set == 0) {
                
//System.out.println("1_");

                tempx = (int) (Math.random() * 1000);
                if (tempx >= 50 && tempx <= 690) {
                    point[p_count][0] = tempx - 401;
                    set = 1;
                }
            }
            set = 0;
            while (set == 0) {
                
//System.out.println("2_");

                tempy = (int) (Math.random() * 1000);
                if (tempy >= 200 && tempy <= 300) {
                    point[p_count][1] = -tempy + 281;
                    set = 1;
                }
            }
            
//System.out.println("3_");

            p_count++;
            g.fillOval(tempx, tempy, 5, 5);
        }
    }

    
// ////////////////////////////

    public void paint(Graphics g) {
        g.setColor(Color.black);
        Font fntName = new Font("Serif", 0, 40);
        g.setFont(fntName);

        g.drawString("y", 378, 50);
   &n


最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册
栏目列表