package com.fangxuele.tool.push;

import com.fangxuele.tool.push.ui.Init;
import com.fangxuele.tool.push.ui.form.LoadingForm;
import com.fangxuele.tool.push.ui.form.MainWindow;
import com.fangxuele.tool.push.ui.frame.MainFrame;
import com.fangxuele.tool.push.util.ConfigUtil;
import com.fangxuele.tool.push.util.MybatisUtil;
import com.fangxuele.tool.push.util.UpgradeUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.SqlSession;

import javax.swing.*;

/**
 * <pre>
 * Main Enter!
 * </pre>
 *
 * @author <a href="https://github.com/rememberber">RememBerBer</a>
 * @since 2019/4/20.
 */
@Slf4j
public class App {
    public static MainFrame mainFrame;

    public static ConfigUtil config = ConfigUtil.getInstance();

    public static SqlSession sqlSession = MybatisUtil.getSqlSession();

    public static void main(String[] args) {
        UpgradeUtil.smoothUpgrade();
        Init.initTheme();
        mainFrame = new MainFrame();
        mainFrame.init();
        JPanel loadingPanel = new LoadingForm().getLoadingPanel();
        mainFrame.add(loadingPanel);
        mainFrame.pack();
        mainFrame.setVisible(true);

        SwingUtilities.invokeLater(() -> {
            mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
            Init.initGlobalFont();
            Init.initAllTab();
            Init.initOthers();
            MainWindow.mainWindow.init();
            mainFrame.setContentPane(MainWindow.mainWindow.getMainPanel());
            mainFrame.addListeners();
            mainFrame.remove(loadingPanel);
            Init.initFontSize();
        });
    }
}

@@ -468,16 +468,35 @@
 swing.*;
+%0Aimport java.awt.*;
 %0A%0A/**%0A *
@@ -1093,32 +1093,254 @@
 (loadingPanel);%0A
+        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();%0A        if (screenSize.getWidth() %3C= 1366) %7B%0A            // %E4%BD%8E%E5%88%86%E8%BE%A8%E7%8E%87%E4%B8%8B%E8%87%AA%E5%8A%A8%E6%9C%80%E5%A4%A7%E5%8C%96%E7%AA%97%E5%8F%A3%0A            mainFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);%0A        %7D%0A
         mainFram

optimize:低分辨率下自动最大化窗口