帆软报表设计器源代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

42 lines
1.1 KiB

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();
}
}