Chinaunix首页 | 论坛 | 博客
  • 博客访问: 627726
  • 博文数量: 796
  • 博客积分: 5000
  • 博客等级: 大校
  • 技术积分: 5095
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-10 09:43
文章分类

全部博文(796)

文章存档

2011年(1)

2008年(795)

我的朋友

分类:

2008-09-10 10:08:13

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


--------------------next---------------------

阅读(303) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~