Procházet zdrojové kódy

自启动+登录自动全屏适配

17491 před 2 týdny
rodič
revize
5434743d91
2 změnil soubory, kde provedl 40 přidání a 0 odebrání
  1. 36 0
      mesclient-startup.bat
  2. 4 0
      src/com/mes/ui/LoginFarme.java

+ 36 - 0
mesclient-startup.bat

@@ -0,0 +1,36 @@
+@echo off
+setlocal
+
+rem This file can be copied directly to the Windows Startup folder.
+rem The JAR is expected to be in the same directory as this BAT file.
+set "MES_CLIENT_HOME=%~dp0"
+set "MES_CLIENT_HOME=%MES_CLIENT_HOME:~0,-1%"
+
+rem If the JAR is installed outside the Startup folder, set its full path here.
+rem Example: set "MES_CLIENT_JAR=C:\MesClient\mesclient.jar"
+set "MES_CLIENT_JAR=D:\mesclient-qm.jar"
+
+rem An optional first argument can also explicitly select the JAR file.
+if not "%~1"=="" set "MES_CLIENT_JAR=%~1"
+
+if not defined MES_CLIENT_JAR (
+    for %%F in ("%MES_CLIENT_HOME%\*.jar") do (
+        set "MES_CLIENT_JAR=%%~fF"
+        goto :jar_found
+    )
+)
+
+:jar_found
+if not defined MES_CLIENT_JAR exit /b 1
+if not exist "%MES_CLIENT_JAR%" exit /b 1
+
+cd /d "%MES_CLIENT_HOME%"
+
+rem Keep the process independent of the Startup-folder command window.
+if exist "%MES_CLIENT_HOME%\lib" (
+    start "MES Client" /b javaw -cp "%MES_CLIENT_JAR%;%MES_CLIENT_HOME%\lib\*" com.mes.ui.MesClient
+) else (
+    start "MES Client" /b javaw -jar "%MES_CLIENT_JAR%"
+)
+
+endlocal

+ 4 - 0
src/com/mes/ui/LoginFarme.java

@@ -181,7 +181,11 @@ public class LoginFarme extends JFrame {
                     //登录成功
                     MesClient.user_menu.setText(user_id);
                     MesClient.welcomeWin.setVisible(false);
+                    // 登录后再最大化,确保主窗口显示时铺满当前屏幕。
+                    MesClient.mesClientFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
                     MesClient.mesClientFrame.setVisible(true);
+                    MesClient.mesClientFrame.revalidate();
+                    MesClient.mesClientFrame.repaint();
 
                     // 初始化开班点检WebView
                     if(MesClient.jfxPanel2 == null){