![]() |
|
||||||||||||||
| | 网站首页 | 电脑技术 | 免费资源 | 文章中心 | 下载中心 | 图片中心 | | ||
|
||
|
|||||
| 文本编辑器源文件(java语言) | |||||
作者:网络 电脑技术来源:www.20888.net 点击数: 更新时间:2006-12-9 ![]() |
|||||
|
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 | |||||
| 【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 | |||||
| 最新热点 | 最新推荐 | 相关文章 | ||
| 没有相关电脑技术 |
| | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 网站公告 | 管理登录 | | |||
|