package home;
|
|
import javax.swing.SwingUtilities;
|
|
public class Mains {
|
// 记录启动时间
|
private static long startTime;
|
|
public static void main(String[] args) {
|
// 记录启动时间
|
startTime = System.currentTimeMillis();
|
// 记录打开日志
|
LogUtil.logOpen();
|
|
try {
|
// 在事件调度线程中创建和显示GUI
|
SwingUtilities.invokeLater(() -> {
|
try {
|
// 创建并显示主界面
|
|
new MainFrame().setVisible(true);
|
|
} catch (Exception e) {
|
e.printStackTrace();
|
LogUtil.log("启动可视化界面时发生错误: " + e.getMessage());
|
}
|
});
|
} finally {
|
// 添加关闭钩子
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
// 记录关闭日志
|
LogUtil.logClose(startTime);
|
// 释放单实例锁
|
SingleInstanceLock.release();
|
}));
|
}
|
|
}
|
}
|