build(twain-service): 升级版本号至 0.1.6.1
- 在 pom.xml 文件中将 twain-service 的版本号从 0.1.6 修改为 0.1.6.1
This commit is contained in:
parent
9f14f01507
commit
a0edae2137
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>org.aohe</groupId>
|
||||
<artifactId>twain-service</artifactId>
|
||||
<version>0.1.6</version>
|
||||
<version>0.1.6.1</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package org.aohe.show;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@Slf4j
|
||||
public class IconUtil {
|
||||
public static Image getIcon() {
|
||||
String iconPath = "ah.png";
|
||||
if(!FileUtil.exist("ah.png")){
|
||||
iconPath = ResourceUtil.getResource("ah.png").getFile();
|
||||
}
|
||||
log.info("当前查找路径为:{}", FileUtil.getAbsolutePath(iconPath));
|
||||
return Toolkit.getDefaultToolkit().getImage(FileUtil.getAbsolutePath(iconPath));
|
||||
}
|
||||
}
|
|
@ -1,23 +1,14 @@
|
|||
package org.aohe.show;
|
||||
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.io.resource.UrlResource;
|
||||
import com.github.sarxos.webcam.util.ImageUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aohe.constant.SocketEnum;
|
||||
import org.aohe.web.SocketUtils;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
|
@ -26,7 +17,7 @@ import java.nio.charset.StandardCharsets;
|
|||
@Slf4j
|
||||
public class TrayFrameUtf8 {
|
||||
|
||||
public static void initSystemTrayUTF8() throws IOException {
|
||||
public static void initSystemTrayUTF8() throws InterruptedException {
|
||||
SocketUtils.start(SocketEnum.SCAN_SOCKET);
|
||||
//使用 JDialog 作为 JPopupMenu 载体
|
||||
JDialog jDialog = new JDialog();
|
||||
|
@ -90,8 +81,13 @@ public class TrayFrameUtf8 {
|
|||
|
||||
jPopupMenu.add(showMainFrame);
|
||||
jPopupMenu.add(exit);
|
||||
URL url = ResourceUtil.getResource("ah.png");
|
||||
Image image = Toolkit.getDefaultToolkit().getImage(url.getFile());
|
||||
Image image = IconUtil.getIcon();
|
||||
|
||||
// 确保图片完全加载
|
||||
MediaTracker mediaTracker = new MediaTracker(new Component() {});
|
||||
mediaTracker.addImage(image, 0);
|
||||
mediaTracker.waitForID(0);
|
||||
|
||||
// 创建系统托盘图标
|
||||
TrayIcon trayIcon = new TrayIcon(image, "Scan Program For AH");
|
||||
// 自动调整系统托盘图标大小
|
||||
|
@ -130,6 +126,7 @@ public class TrayFrameUtf8 {
|
|||
tray.add(trayIcon);
|
||||
} catch (AWTException ex) {
|
||||
ex.printStackTrace();
|
||||
log.error(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue