mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-24 03:33:46 -04:00
删除 AwtUtils (#4460)
This commit is contained in:
parent
f41b008b42
commit
cf5957ffd1
@ -18,7 +18,6 @@
|
|||||||
package org.jackhuang.hmcl;
|
package org.jackhuang.hmcl;
|
||||||
|
|
||||||
import org.jackhuang.hmcl.util.FileSaver;
|
import org.jackhuang.hmcl.util.FileSaver;
|
||||||
import org.jackhuang.hmcl.ui.AwtUtils;
|
|
||||||
import org.jackhuang.hmcl.util.SelfDependencyPatcher;
|
import org.jackhuang.hmcl.util.SelfDependencyPatcher;
|
||||||
import org.jackhuang.hmcl.util.SwingUtils;
|
import org.jackhuang.hmcl.util.SwingUtils;
|
||||||
import org.jackhuang.hmcl.java.JavaRuntime;
|
import org.jackhuang.hmcl.java.JavaRuntime;
|
||||||
@ -110,8 +109,14 @@ public final class EntryPoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void initIcon() {
|
private static void initIcon() {
|
||||||
java.awt.Image image = java.awt.Toolkit.getDefaultToolkit().getImage(EntryPoint.class.getResource("/assets/img/icon-mac.png"));
|
try {
|
||||||
AwtUtils.setAppleIcon(image);
|
if (java.awt.Taskbar.isTaskbarSupported()) {
|
||||||
|
var image = java.awt.Toolkit.getDefaultToolkit().getImage(EntryPoint.class.getResource("/assets/img/icon-mac.png"));
|
||||||
|
java.awt.Taskbar.getTaskbar().setIconImage(image);
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
LOG.warning("Failed to set application icon", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkDirectoryPath() {
|
private static void checkDirectoryPath() {
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
package org.jackhuang.hmcl.ui;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
public final class AwtUtils {
|
|
||||||
private AwtUtils() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setAppleIcon(Image image) {
|
|
||||||
try {
|
|
||||||
Class<?> taskbarClass = Class.forName("java.awt.Taskbar");
|
|
||||||
Method getTaskBarMethod = taskbarClass.getDeclaredMethod("getTaskbar");
|
|
||||||
Object taskBar = getTaskBarMethod.invoke(null);
|
|
||||||
Method setIconImageMethod = taskbarClass.getDeclaredMethod("setIconImage", Image.class);
|
|
||||||
setIconImageMethod.invoke(taskBar, image);
|
|
||||||
} catch (Throwable ignore) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user