Compare commits

...

2 Commits

2 changed files with 17 additions and 2 deletions

View File

@ -6,7 +6,7 @@
<groupId>org.aohe</groupId> <groupId>org.aohe</groupId>
<artifactId>sane-service</artifactId> <artifactId>sane-service</artifactId>
<version>0.3.1</version> <version>0.3.2</version>
<name>aohe-sane-service</name> <name>aohe-sane-service</name>
@ -71,6 +71,12 @@
<version>3.4.1</version> <version>3.4.1</version>
<classifier>no-natives</classifier> <classifier>no-natives</classifier>
</dependency> </dependency>
<dependency>
<groupId>io.github.sanyarnd</groupId>
<artifactId>app-locker</artifactId>
<version>1.2.0</version>
</dependency>
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>com.formdev</groupId>--> <!-- <groupId>com.formdev</groupId>-->
<!-- <artifactId>flatlaf</artifactId>--> <!-- <artifactId>flatlaf</artifactId>-->

View File

@ -1,6 +1,7 @@
package org.aohe; package org.aohe;
import com.formdev.flatlaf.FlatDarculaLaf; import com.formdev.flatlaf.FlatDarculaLaf;
import io.github.sanyarnd.applocker.AppLocker;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.aohe.core.sane.utils.SaneSessionUtils; import org.aohe.core.sane.utils.SaneSessionUtils;
import org.aohe.core.swing.NewWindow; import org.aohe.core.swing.NewWindow;
@ -14,13 +15,21 @@ import javax.swing.*;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
log.info(" 当前系统类型: {}", SystemUtils.getOsName()); log.info(" 当前系统类型: {}", SystemUtils.getOsName());
try { try (AppLocker locker = AppLocker.create("aoheSaneServiceLock").build()){
//启动锁只允许启动一个
locker.lock();
//设置窗口主题 //设置窗口主题
//FlatLightLaf.setup(); //FlatLightLaf.setup();
UIManager.setLookAndFeel(new FlatDarculaLaf()); UIManager.setLookAndFeel(new FlatDarculaLaf());
} catch (UnsupportedLookAndFeelException e) { } catch (UnsupportedLookAndFeelException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} catch (Exception ex) {
log.info("应用已经启动,当前进程退出。");
System.exit(0);
} }
//初始化其他资源 //初始化其他资源
init(); init();