📄 advancedtrayicon.java
字号:
/**
* @(#)AdvancedTrayIcon.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: AdvancedTrayIcon.java,v 1.1 2002/03/17 07:46:48 xrath Exp $
*/
package rath.tools.tray;
import java.awt.Image;
import java.io.UnsupportedEncodingException;
/**
* Shell32.dll version 5.0 捞惑俊辑父 蜡瓤茄 矫胶袍 飘饭捞俊辑狼
* 浅急档框富殿狼 眠啊沥焊甫 唱鸥郴绊 酵阑锭 荤侩窍绰 飘饭捞 沥焊 努贰胶捞促.
* <p>
* 捞 努贰胶甫 烹秦 飘饭捞俊 殿废阑 窍霸 登搁, 秦寸 浅急 档框富篮 殿废 荐青阑
* 窍绰 溜矫, 浅急档框富捞 唱鸥朝 巴捞哥, 敲阀汽付促 促福瘤父, 距 10檬 饶俊
* 磊悼栏肺 荤扼龙 巴捞促. 焊咯临 鞘夸己捞 乐阑锭付促
* {@link TrayIconManager#modifyTrayIcon(rath.tools.tray.TrayIcon,int)
* TrayIconManager.modifyTrayIcon} 皋家靛甫 烹窍咯 函悼 荤角阑 烹瘤秦林绢具 茄促.
* <p>
* Shell32.dll篮 扁夯利栏肺 Windows ME/2000俊父 扁夯利栏肺 硅器登绢乐绰 dll捞促.
* 弊矾骨肺 AdvancedTrayIconInfo绰 Windows ME/2000 俊辑父 荤侩啊瓷 茄 努贰胶捞促.
*
* @author Jangho Hwang, windrath@hanmail.net
* @version $Id: AdvancedTrayIcon.java,v 1.1 2002/03/17 07:46:48 xrath Exp $, since 2001/12/19
*/
public class AdvancedTrayIcon extends TrayIcon
{
/**
* 浅急档框富 扁瓷阑 唱鸥郴绰 int屈 惑荐捞促.
*/
public static final int TYPE_BALOON = 0x00000010;
/**
* 浅急 档框富 力格狼 糠俊 酒捞能阑 持瘤 臼摆促绰 惑荐捞促.
*/
public static final int ICON_NONE = 0;
/**
* 浅急 档框富 力格狼 糠俊 沥焊 酒捞能(蠢肠钎)甫 唱鸥郴绰 惑荐捞促.
*/
public static final int ICON_INFORMATION = 1;
/**
* 浅急 档框富 力格狼 糠俊 版绊 酒捞能阑 唱鸥郴绰 惑荐捞促.
*/
public static final int ICON_WARNING = 2;
/**
* 浅急 档框富 力格狼 糠俊 坷幅 酒捞能(X钎矫)甫 唱鸥郴绰 惑荐捞促.
*/
public static final int ICON_ERROR = 3;
private String baloonText = ""; // Default value
private String baloonTitle = ""; // Default value
private int infoFlag = ICON_NONE; // Default value
public AdvancedTrayIcon( NativeIcon icon )
{
super( icon );
}
public AdvancedTrayIcon( NativeIcon icon, String tip )
{
super( icon, tip );
}
/**
* 泅犁 浅急 档框富狼 郴侩阑 掘绢柯促.
*/
public String getBaloonText()
{
return this.baloonText;
}
/**
* 泅犁 浅急 档框富狼 郴侩阑 system default encoding阑 捞侩窍咯
* byte[] 屈怕肺 函券窍咯 馆券茄促.
*/
public byte[] getBaloonTextBytes() throws UnsupportedEncodingException
{
return super.getBytes(this.baloonText);
}
/**
* 浅急 档框富 郴侩阑 汲沥茄促.
*/
public void setBaloonText( String text )
{
if( text==null )
text = "";
this.baloonText = text;
}
/**
* 泅犁 汲沥等 浅急 档框富 力格阑 掘绢柯促.
*/
public String getBaloonTitle()
{
return this.baloonTitle;
}
/**
* 泅犁 浅急 档框富狼 力格阑 system default encoding阑 捞侩窍咯
* byte[] 屈怕肺 函券窍咯 馆券茄促.
*/
public byte[] getBaloonTitleBytes() throws UnsupportedEncodingException
{
return super.getBytes(this.baloonTitle);
}
/**
* 浅急 档框富狼 力格阑 汲沥茄促. 捞 力格篮 浅急 档框富捞 popup 窍看阑锭
* 惑窜俊 <b>Bold</b> 屈怕肺 力格 酒捞能 官肺 糠俊 唱鸥唱绰 力格捞促.
*/
public void setBaloonTitle( String title )
{
if( title==null )
title = "";
this.baloonTitle = title;
}
/**
* 浅急 档框富狼 力格 谅螟俊 炼弊付茄 酒捞能阑 窍唱 持阑 荐 乐绰单, 弊 蔼阑
* 汲沥茄促. 捞 蔼栏肺绰 ICON_NONE, ICON_INFO, ICON_WARNING, ICON_ERROR 啊
* 荤侩瞪 荐 乐栏哥, default 蔼篮 ICON_NONE捞促.
*/
public void setBaloonIcon( int icon )
{
this.infoFlag = icon;
}
/**
* 泅犁 汲沥等 浅急 档框富 酒捞能 内靛甫 啊廉柯促. 捞 蔼篮
* ICON_NONE, ICON_INFO, ICON_WARNING, ICON_ERROR 吝狼 窍唱啊 瞪 巴捞促.
*/
public int getBaloonIcon()
{
return this.infoFlag;
}
/**
* 捞 飘饭捞酒捞能 努贰胶啊 泅犁 敲阀汽俊辑 荤侩啊瓷茄 努贰胶牢瘤
* 炼荤窍咯 霖促.
*/
private boolean isAvailablePlatform()
{
String os = System.getProperty("os.name").toLowerCase();
if( os.startsWith("windows me") ||
os.startsWith("windows 20") ||
os.startsWith("windows wh") ||
os.startsWith("windows xp") )
return true;
return false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -