|
|
|
@ -8,6 +8,7 @@ import com.formdev.flatlaf.FlatLaf;
|
|
|
|
|
import com.formdev.flatlaf.ui.FlatUIUtils; |
|
|
|
|
import com.formdev.flatlaf.util.GrayFilter; |
|
|
|
|
import com.fr.clone.cloning.Immutable; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.value.NullableLazyValue; |
|
|
|
|
import com.github.weisj.jsvg.SVGDocument; |
|
|
|
|
import com.github.weisj.jsvg.attributes.ViewBox; |
|
|
|
@ -112,12 +113,16 @@ public class SvgIcon implements DisabledIcon, WhiteIcon, Icon {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void render(Component c, Graphics g, int x, int y) { |
|
|
|
|
if (type == Type.white) { |
|
|
|
|
Objects.requireNonNull(whiteSvgDocument.getValue()) |
|
|
|
|
.render((JComponent) c, (Graphics2D) g, new ViewBox(x, y, size.width, size.height)); |
|
|
|
|
} else { |
|
|
|
|
Objects.requireNonNull(svgDocument.getValue()) |
|
|
|
|
.render((JComponent) c, (Graphics2D) g, new ViewBox(x, y, size.width, size.height)); |
|
|
|
|
try { |
|
|
|
|
if (type == Type.white) { |
|
|
|
|
Objects.requireNonNull(whiteSvgDocument.getValue()) |
|
|
|
|
.render((JComponent) c, (Graphics2D) g, new ViewBox(x, y, size.width, size.height)); |
|
|
|
|
} else { |
|
|
|
|
Objects.requireNonNull(svgDocument.getValue()) |
|
|
|
|
.render((JComponent) c, (Graphics2D) g, new ViewBox(x, y, size.width, size.height)); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
FineLoggerFactory.getLogger().error("SvgIcon from url: " + resource + "can not paint.", e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|