毛兴宇签名档

package test.com;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Desktop;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

import javax.swing.JFrame;
import javax.swing.JLabel;




public class Signature implements MouseListener,WindowListener {
	private JLabel lable;
	private JFrame frame;
	
	public Signature() {
		frame = new JFrame();
		frame.setBounds(100, 100, 260, 100);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(null);
		frame.addWindowListener(this);
		
		lable = new JLabel("Make by:mxyseo");
		lable.addMouseListener(this);
		lable.setBounds(86, 24, 100, 15);
		frame.getContentPane().add(lable, BorderLayout.CENTER);	
		frame.setVisible(true);
		//JLable变色线程
		new Thread(new Runnable() { 
			public void run() { 
				while(true) { 
					try {
					lable.setForeground(Color.RED);
					Thread.currentThread().sleep(1000);
					lable.setForeground(Color.YELLOW);
					Thread.currentThread().sleep(1000);
					lable.setForeground(Color.GREEN);
					Thread.currentThread().sleep(1000);
					} catch (InterruptedException e) {
						// TODO 自动生成的 catch 块
						e.printStackTrace();
					} 
				} 
				} 
				}).start(); 
	}

	//JLable监听鼠标点击。
	@Override
	public void mouseClicked(MouseEvent e) {
		if(e.getSource().equals(lable)){
			try {
				URI uri = new URI("http://blog.csdn.net/powmxypow");
				Desktop.getDesktop().browse(uri);
			} catch (URISyntaxException m) {
				m.printStackTrace();
			} catch (IOException m) {
				m.printStackTrace();
			}
		}
		
	}

	//MouseListener方法实现
	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO 自动生成的方法存根
		
	}


	@Override
	public void mouseExited(MouseEvent e) {
		// TODO 自动生成的方法存根
		
	}


	@Override
	public void mousePressed(MouseEvent e) {
		// TODO 自动生成的方法存根
		
	}


	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO 自动生成的方法存根
		
	}
	
	
	//WindowListener方法实现
	@Override
	public void windowActivated(WindowEvent e) {
		// TODO 自动生成的方法存根
		
	}
	@Override
	public void windowClosed(WindowEvent e) {
		// TODO 自动生成的方法存根
		
	}
	@Override
	public void windowClosing(WindowEvent e) {
		try {
			URI uri = new URI("http://blog.csdn.net/powmxypow");
			Desktop.getDesktop().browse(uri);
		} catch (URISyntaxException m) {
			m.printStackTrace();
		} catch (IOException m) {
			m.printStackTrace();
		}
		
	}
	@Override
	public void windowDeactivated(WindowEvent e) {
		// TODO 自动生成的方法存根
		
	}
	@Override
	public void windowDeiconified(WindowEvent e) {
		// TODO 自动生成的方法存根
		
	}
	@Override
	public void windowIconified(WindowEvent e) {
		// TODO 自动生成的方法存根
		
	}
	@Override
	public void windowOpened(WindowEvent e) {
		// TODO 自动生成的方法存根
		
	}
	public static void main(String[] args) {
		new Signature();
		
	}

}

你可能感兴趣的:(签名档,mxyseo)