forked from fanruan/design
Browse Source
* commit '9473a3013d1078e408852fd94f7514bf667d941c': REPORT-60789【开发者预览支持调整模板布局】新自适应-本地环境模板进入开发者调试,路径处显示已锁定但模板图标上没有锁图标,远程下是有的 REPORT-61844 【设计器11.0】高分屏修改dpi,切换帆软账号,弹窗没有自适应,鼠标点击串行 REPORT-62133 mac设计器安装包起不来 REPORT-60748 决策报表-属性-坐标尺寸交互问题feature/x
superman
3 years ago
14 changed files with 140 additions and 26 deletions
@ -0,0 +1,42 @@ |
|||||||
|
package com.fr.design.icon; |
||||||
|
|
||||||
|
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.design.gui.itree.filetree.FileTreeIcon; |
||||||
|
|
||||||
|
import javax.swing.Icon; |
||||||
|
import java.awt.Component; |
||||||
|
import java.awt.Graphics; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by kerry on 2021/11/11 |
||||||
|
*/ |
||||||
|
public class LocalFileIcon implements Icon { |
||||||
|
private static final Icon FILE_LOCKED_ICON = BaseUtils.readIcon(FileTreeIcon.FILE_LOCKED_ICON_PATH); |
||||||
|
private static final int OFFSET_X = 9; |
||||||
|
private static final int OFFSET_Y = 8; |
||||||
|
private final Icon mainIcon; |
||||||
|
private final boolean showLock; |
||||||
|
|
||||||
|
public LocalFileIcon(Icon mainIcon, boolean showLock) { |
||||||
|
this.mainIcon = mainIcon; |
||||||
|
this.showLock = showLock; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void paintIcon(Component c, Graphics g, int x, int y) { |
||||||
|
mainIcon.paintIcon(c, g, x, y); |
||||||
|
if (showLock) { |
||||||
|
FILE_LOCKED_ICON.paintIcon(c, g, OFFSET_X, OFFSET_Y); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int getIconWidth() { |
||||||
|
return mainIcon.getIconWidth(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int getIconHeight() { |
||||||
|
return mainIcon.getIconHeight(); |
||||||
|
} |
||||||
|
} |
After Width: | Height: | Size: 225 B |
Loading…
Reference in new issue