Browse Source
Merge in DESIGN/design from ~KERRY/design_10.0:release/11.0 to release/11.0 * commit 'e86dd190a6158cdf9ea8471e8e387ad3f58ff4aa': REPORT-60789【开发者预览支持调整模板布局】新自适应-本地环境模板进入开发者调试,路径处显示已锁定但模板图标上没有锁图标,远程下是有的bugfix/11.0
kerry
3 years ago
4 changed files with 52 additions and 6 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