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

📄 trayicon.java

📁 java实现msn的功能
💻 JAVA
字号:
/*
 * @(#)TrayIcon.java
 *
 * Copyright (c) 2001 Jangho Hwang,
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 
 * 	1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * 
 * 	2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * 
 * 	3. Neither the name of the JangHo Hwang nor the names of its contributors
 * may be used to endorse or promote products derived from this software
 * without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *    $Id: TrayIcon.java,v 1.1 2002/03/17 07:46:48 xrath Exp $
 */
package rath.tools.tray;

import java.awt.Image;
import java.io.UnsupportedEncodingException;
/**
 * 飘饭捞酒捞能栏肺 殿废秦具且 沥焊甸阑 淬篮 努贰胶捞促.
 *
 * @author Jangho Hwang, windrath@hanmail.net
 * @version $Id: TrayIcon.java,v 1.1 2002/03/17 07:46:48 xrath Exp $, since 2001/12/17
 */
public class TrayIcon
{
	/**
	 * 飘饭捞酒捞能 函版矫 荤侩登哥, Icon狼 函版捞 利侩登绢具 且锭 荤侩登绰 鞘靛捞促.
	 */
	public static final int TYPE_ICON        = 0x00000002;
	/**
	 * 飘饭捞酒捞能 函版矫 荤侩登哥, 砒屏狼 函版捞 利侩登绢具 且锭 荤侩登绰 鞘靛捞促.
	 */
	public static final int TYPE_TIP         = 0x00000004;

	private int uid = -1;
	private NativeIcon icon = null;
	private String tip = null;

	/**
	 * 秦寸 icon父阑 啊瘤绰 飘饭捞酒捞能 按眉甫 积己茄促.
	 */
	public TrayIcon( NativeIcon icon )
	{
		this( icon, null );
	}

	/**
	 * 秦寸 icon苞 tooltip(付快胶甫 棵府搁 钎矫登绰)阑 啊瘤绰 飘饭捞酒捞能 按眉甫 
	 * 积己茄促.
	 */
	public TrayIcon( NativeIcon icon, String tip )
	{
		setIcon( icon );
		setToolTip( tip );
	}

	/**
	 * Shell_NotifyIcon 窃荐啊 阿 飘饭捞酒捞能阑 备盒且 绊蜡 备盒磊甫 汲沥茄促.
	 * 捞 蔼篮 TrayIconManager甫 烹秦 汲沥登绰 蔼栏肺 窃何肺 函版秦辑绰 救等促.
	 */
	void setUniqueID( int uid )
	{
		this.uid = uid;
	}

	/**
	 * 捞 飘饭捞酒捞能阑 备盒窍绰 绊蜡 备盒磊甫 掘绢柯促.
	 */
	int getUniqueID()
	{
		return this.uid;
	}

	/**
	 * 林绢柳 icon 捞固瘤肺 飘饭捞 酒捞能阑 函版茄促. 捞 皋家靛甫 龋免窍扁父 窍搁 
	 * 登绰 巴捞 酒聪扼, 
	 * {@link TrayIconManager#modifyTrayIcon(rath.tools.tray.TrayIcon,int) TrayIconManager.modifyTrayIcon}
	 * 皋家靛甫 烹秦 函版等 荤角阑 舅妨林绢具父 利侩等促.
	 */
	public void setIcon( NativeIcon icon )
	{
		if( icon==null )
			throw new IllegalArgumentException( "icon is null" );

		this.icon = icon;
	}

	/**
	 * 泅犁 汲沥等 酒捞能阑 馆券茄促.
	 */
	public NativeIcon getIcon()
	{
		return this.icon;
	}

	long getIconHandle()
	{
		return this.icon.getIconHandle();
	}

	/**
	 * 酒捞能俊 付快胶甫 棵妨躇阑锭, 钎矫瞪 砒屏 咆胶飘甫 汲沥茄促.
	 * {@link #setIcon(rath.tools.tray.NativeIcon) setIcon} 皋家靛贸烦 
	 * {@link TrayIconManager#modifyTrayIcon(rath.tools.tray.TrayIcon,int) TrayIconManager.modifyTrayIcon} 
	 * 皋家靛甫 烹秦 函版等 荤角阑 舅妨林绢具父 利侩等促.
	 */
	public void setToolTip( String tip )
	{
		this.tip = tip;
	}

	/**
	 * 泅犁 汲沥登绢乐绰 砒屏 咆胶飘甫 啊廉柯促.
	 */
	public String getToolTip()
	{
		return this.tip;
	}

	protected byte[] getBytes( String str ) throws UnsupportedEncodingException
	{
		return getBytes( str, System.getProperty("file.encoding") );
	}

	protected byte[] getBytes( String str, String enc ) throws UnsupportedEncodingException
	{
		if( str==null )
			return null;
		return str.getBytes(enc);
	}

	/**
	 * 泅犁 tooltip 皋矫瘤甫 矫胶袍狼 default encoding set阑 荤侩窍咯 byte[]肺
	 * 函券矫挪 蔼阑 馆券茄促.
	 */
	public byte[] getToolTipBytes() throws UnsupportedEncodingException
	{
		return getBytes( this.tip );
	}

	/**
	 * 泅犁 tooltip 皋矫瘤甫 林绢柳 encoding set阑 荤侩窍咯 byte[]肺 
	 * 函券矫挪 蔼阑 馆券茄促.
	 */
	public byte[] getToolTipBytes( String enc ) throws UnsupportedEncodingException
	{
		return getBytes( this.tip, enc );
	}
}

⌨️ 快捷键说明

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