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

📄 colormenu.java

📁 该程序的功能是连接邮件服务器,从邮件服务器上接收邮件,也可以发送邮件给邮件服务器.
💻 JAVA
字号:
//colormenu.java
import java.applet.Applet;
import java.awt.*;
import java.awt.image.*;
import java.util.*;
import java.net.URL;

public class colormenu extends Applet implements Runnable{
	
	Cursor cursor;
	Thread runner;
	Image offimage;
	Graphics off;
	String text [];
	int antal=0;
	Font font ;
	URL links [];
	int f1,f2,f3,f4,f5,f6,b1,b2,b3,b4,b5,b6,b7,b8,b9; // Colors
	String tfarve, target="_self";
	boolean firsttime = true;
	int Width, Height;
	int over=-1;
	int bf=0;
	int border=0;
	
	
	public void update (Graphics g)
		
	{
		paint(g);
	}
	
	public void init () {
		
		
		
		tfarve=getParameter("selection_color");
		b7= Integer.parseInt(tfarve.substring(0,3));	
		b8= Integer.parseInt(tfarve.substring(4,7));
		b9= Integer.parseInt(tfarve.substring(8,11));
		
		tfarve=getParameter("text_color");
		f4= Integer.parseInt(tfarve.substring(0,3));	
		f5= Integer.parseInt(tfarve.substring(4,7));
		f6= Integer.parseInt(tfarve.substring(8,11));
		
		tfarve=getParameter("background_color");
		f1= Integer.parseInt(tfarve.substring(0,3));	
		f2= Integer.parseInt(tfarve.substring(4,7));
		f3= Integer.parseInt(tfarve.substring(8,11));
		
		tfarve=getParameter("border_color");
		b1= Integer.parseInt(tfarve.substring(0,1));	
		b2= Integer.parseInt(tfarve.substring(2,3));
		b3= Integer.parseInt(tfarve.substring(4,5));
		
		tfarve=getParameter("fade_color");
		b4= Integer.parseInt(tfarve.substring(0,1));	
		b5= Integer.parseInt(tfarve.substring(2,3));
		b6= Integer.parseInt(tfarve.substring(4,5));
		
		tfarve=getParameter("fontface");
		font = new Font(tfarve,Font.PLAIN,Integer.parseInt(getParameter("fontsize")));
		if (getParameter("target")!=null) target=getParameter("target");
		
		
		
		for (int i=1 ; getParameter ("text"+i) != null ; i++) antal++;
		text = new String [antal];
		links = new URL [antal];
		
		
		for (int i=0; i<antal; i++)
		{
			try {
				links[i] = new URL (getCodeBase(), getParameter ("link"+(i+1)));
			 } catch (Exception e) {}				
			 text[i] = getParameter ("text"+(i+1));
		}
		
		Width = size().width;	
		Height = size().height;
		
		offimage = createImage(Width,Height);
		off = offimage.getGraphics();
		off.setFont(font);
		off.setColor(new Color(f1,f2,f3));
		off.fillRect(0,0,Width,Height);
	}
	
	//绘制图象
	public void paint (Graphics g)	{
		
		g.drawImage(offimage,0,0,this);	
		
	}
	
	public void start() {
		getFrame(this).setCursor(Frame.HAND_CURSOR) ;
		
		if (runner == null); {
			runner = new Thread(this);
			runner.start();
		}
	}
	
	public void stop() {
		if (runner != null) {
			runner.stop();
			runner = null;
		}
	}
	
	public void run() {
		
		while (true)
		{
			
			
			for (int i=0; i<antal; i++)
			{
				//if (over==i) bf=200; else bf=0;
				
				if (firsttime)
				{
					// Draws the borders
					off.setColor(new Color(190*b1,190*b2,190*b3));
					off.drawRect(0,0+i*30,Width,30);
					off.setColor(new Color(110*b1,110*b2,110*b3));
					off.drawRect(1,1+i*30,Width-2,28);
					off.setColor(new Color(70*b1,70*b2,70*b3));
					off.drawRect(2,2+i*30,Width-4,26);
					
					// 绘制背景
					for (int j=0; j<Width-4; j+=2)
					{
						off.setColor(new Color((int)(b4*j/1.2),(int)(b5*j/1.2),(int)(b6*j/1.2)));
						off.drawLine(3+j,4+i*30,3+j,3+i*30+23);
					}
					
					// 绘制连接
					off.setColor(new Color(f4,f5,f6));
					off.drawString(text[i],8,21+i*30);
					
				}
				
				off.setColor(new Color(f1,f2,f3)); // 清除选中的部分
				off.drawRect(3,3+i*30,Width-6,24);	
				
				
				if (i==over)
				{
					off.setColor(new Color(b7,b8,b9)); // 绘制白色的选中的部分
					off.drawRect(3,3+i*30,Width-6,24);
				}
				
			}
			
			
			
			firsttime=false;
			
			
			repaint();
			try {Thread.sleep(50);}
			catch (InterruptedException e) {showStatus("Error " + e);}
		}
		
	}
	
	public Frame getFrame(Component c) {
		while( c != null && !(c instanceof java.awt.Frame) )
			c = c.getParent();
		return (Frame) c;
	}
	
	
	// ********************* MOUSEHANDLING
	// ********************* MOUSEHANDLING
	
	public boolean mouseMove(Event e, int x, int y) // 鼠标移动,找到新的区域
	{						// for the white selection
		for (int i=0; i<antal; i++)
			if (y>30*i && y<30+30*i ) { over =i; return true; }
			return true;
	}
	
	
	public boolean mouseDown(Event e, int x, int y) // 鼠标点击的处理
	{
		for (int i=0; i<antal; i++)
			if (y>30*i && y<30+30*i ) { getAppletContext().showDocument(links[i],target);	 }
			return true;
	}   	
	
	public boolean mouseExit(Event e, int x, int y) // 鼠标离开applet
	{
		over=-1; return true;
	}
	
	}

⌨️ 快捷键说明

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