网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 天空资源网 >> 电脑技术 >> 编程技术 >> JAVA >> 电脑技术正文
  文本编辑器源文件(java语言)          【字体:
文本编辑器源文件(java语言)
作者:网络    电脑技术来源:www.20888.net    点击数:    更新时间:2006-12-9    
/版权所有helj
import java.awt.*;
import java.io.*;
import java.util.*;
//W_color;C_str;C_file;C_back;W_find;W_fond

interface I_Method
{
    public void setQuit();
    public void setfont(Font f);
    public void setcolor(Color c);
    public void Find(String find,int dire);
}



class D_color extends Dialog
{
    private Button OK,Cancel;
    private I_Method mp;
    private Rectangle test;

    private Color current= Color.black;
    private Color []colors;
    private Color []colors1;
    private Color []colors2;
    private int strlen= 250;

    public D_color(Frame fr,I_Method mp,int x,int y)
    {
        super(fr,"调色板",true);
        this.mp= mp;
        colors= new Color[strlen];
        colors1= new Color[strlen];
        colors2= new Color[strlen];
        for (int i = 0; i < strlen; i++)
        {
            float h = ((float)i)/((float)strlen);
colors[i] = new Color(Color.HSBtoRGB(h,1.0f,1.0f));
        }
        for (int i = 0; i < strlen; i++)
        {
            float h = ((float)i)/((float)strlen);
colors1[i] = new Color(Color.HSBtoRGB(1.0f,h,1.0f));
        }
        for (int i = 0; i < strlen; i++)
        {
            float h = ((float)i)/((float)strlen);
colors2[i] = new Color(Color.HSBtoRGB(1.0f,1.0f,h));
        }
       
        setLayout(null);
        OK= new Button("确定");
        Cancel= new Button("取消");
        OK.reshape(320,100,80,30);
        add(OK);
        Cancel.reshape(320,150,80,30);
        add(Cancel);        
        test= new Rectangle(0,0,300,250);
        reshape(x/2-210,y/2-140,420,280);
        show();
    }

    public void update(Graphics g)
    {
        int y= 0;
        for (int i = 0; i < strlen; i++)
        {
            g.setColor(colors[i]);
            g.fillRect(0,y,100,1);
            y+=1;
        }
        y= 0;
        for (int i = 0; i < strlen; i++)
        {
            g.setColor(colors1[i]);
            g.fillRect(100,y,100,1);
            y+=1;
        }
        y= 0;
        for (int i = 0; i < strlen; i++)
        {
            g.setColor(colors2[i]);
            g.fillRect(200,y,100,1);
            y+=1;
        }
        g.setColor(current);
        g.fillRect(330,30,60,60);
    }
   
    public void paint(Graphics g)
    {
        update(g);
    }

    public boolean mouseMove(Event evt,int x,int y)
    {
        if(test.inside(x,y))
        {
            Graphics g1= getGraphics();
            //g1.drawImage(back,oldx,oldy);
            //g1.clipRect(x-3,y-3,6,6);
            g1.setColor(Color.white);
            g1.drawArc(x-3,y-3,6,6,60,360);
            g1.drawLine(x-3,y,x+3,y);
            g1.drawLine(x,y-3,x,y+3);
         &nbs

[1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

电脑技术录入:lcsnow    责任编辑:lcsnow 
  • 上一篇电脑技术:

  • 下一篇电脑技术:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
    没有相关电脑技术
    Copyright @ 2006 天空资源网 All Rights Reserved
    Designed by: lcsnow E-mail: admin#seesky.net
    皖ICP备05005479号