@ -185,13 +185,25 @@ public abstract class UpdateAction extends ShortCut implements Action {
* @param resource 图标资源路径
* @param resource 图标资源路径
* /
* /
public void setSmallIcon ( String resource ) {
public void setSmallIcon ( String resource ) {
setSmallIcon ( resource , true ) ;
}
/ * *
* 使用传入资源url的方式设置Icon , 会自动设置_normal . svg , 然后通过needDisable参数判断是否需要自动设置_disable . svg
* 因为有些地方是不需要设置灰化图标的 , 所以不存在灰化图标资源 , 这边如果一并设置 , 就会报错文件找不到
* @param resource
* @param needDisable
* /
public void setSmallIcon ( String resource , boolean needDisable ) {
if ( StringUtils . equals ( resource , StringUtils . EMPTY ) ) {
if ( StringUtils . equals ( resource , StringUtils . EMPTY ) ) {
this . putValue ( Action . SMALL_ICON , null ) ;
this . putValue ( Action . SMALL_ICON , null ) ;
return ;
return ;
}
}
this . putValue ( Action . SMALL_ICON , IconUtils . readIcon ( resource ) ) ;
this . putValue ( Action . SMALL_ICON , IconUtils . readIcon ( resource ) ) ;
if ( needDisable ) {
this . putValue ( UpdateAction . DISABLED_ICON , IconUtils . readSVGIcon ( resource , IconUtils . ICON_TYPE_DISABLED ) ) ;
this . putValue ( UpdateAction . DISABLED_ICON , IconUtils . readSVGIcon ( resource , IconUtils . ICON_TYPE_DISABLED ) ) ;
}
}
}
public void setSmallIcon ( Icon [ ] smallIcon , boolean white ) {
public void setSmallIcon ( Icon [ ] smallIcon , boolean white ) {
this . putValue ( Action . SMALL_ICON , smallIcon ) ;
this . putValue ( Action . SMALL_ICON , smallIcon ) ;