merge
This commit is contained in:
parent
735f84622e
commit
03198ccc23
46
pom.xml
46
pom.xml
|
@ -18,19 +18,19 @@
|
|||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
|
||||
<java.version>1.8</java.version>
|
||||
<logback.version>1.2.3</logback.version>
|
||||
<logback.version>1.2.10</logback.version>
|
||||
<forms_rt.version>7.0.3</forms_rt.version>
|
||||
<AppleJavaExtensions.version>1.4</AppleJavaExtensions.version>
|
||||
<lombok.version>1.18.20</lombok.version>
|
||||
<junit-jupiter-api.version>5.8.1</junit-jupiter-api.version>
|
||||
<commons-lang3.version>3.11</commons-lang3.version>
|
||||
<guava.version>29.0-jre</guava.version>
|
||||
<okhttp.version>4.9.0</okhttp.version>
|
||||
<flatlaf.version>1.6.3</flatlaf.version>
|
||||
<flatlaf-extras.version>1.6.3</flatlaf-extras.version>
|
||||
<hutool-all.version>5.6.3</hutool-all.version>
|
||||
<fastjson.version>1.2.74</fastjson.version>
|
||||
<lombok.version>1.18.22</lombok.version>
|
||||
<junit-jupiter-api.version>5.8.2</junit-jupiter-api.version>
|
||||
<commons-lang3.version>3.12.0</commons-lang3.version>
|
||||
<guava.version>31.0.1-jre</guava.version>
|
||||
<okhttp.version>4.9.3</okhttp.version>
|
||||
<flatlaf.version>2.0.1</flatlaf.version>
|
||||
<flatlaf-extras.version>2.0.1</flatlaf-extras.version>
|
||||
<flatlaf-intellij-themes.version>2.0.1</flatlaf-intellij-themes.version>
|
||||
<hutool-all.version>5.7.21</hutool-all.version>
|
||||
<fastjson.version>1.2.79</fastjson.version>
|
||||
<jfreechart.version>1.5.3</jfreechart.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -54,12 +54,6 @@
|
|||
<version>${forms_rt.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.apple</groupId>
|
||||
<artifactId>AppleJavaExtensions</artifactId>
|
||||
<version>${AppleJavaExtensions.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
@ -83,6 +77,12 @@
|
|||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>${okhttp.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -97,6 +97,12 @@
|
|||
<version>${flatlaf-extras.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.formdev</groupId>
|
||||
<artifactId>flatlaf-intellij-themes</artifactId>
|
||||
<version>${flatlaf-intellij-themes.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
|
@ -115,7 +121,7 @@
|
|||
<plugin>
|
||||
<groupId>io.github.fvarrui</groupId>
|
||||
<artifactId>javapackager</artifactId>
|
||||
<version>1.6.2</version>
|
||||
<version>1.6.3</version>
|
||||
<configuration>
|
||||
<bundleJre>true</bundleJre>
|
||||
<mainClass>com.luoboduner.moo.info.App</mainClass>
|
||||
|
@ -141,7 +147,7 @@
|
|||
|
||||
<!-- setup generation properties -->
|
||||
<setupMode>installForAllUsers</setupMode>
|
||||
<!-- <createDesktopIconTask>true</createDesktopIconTask>-->
|
||||
<createDesktopIconTask>true</createDesktopIconTask>
|
||||
<disableDirPage>false</disableDirPage>
|
||||
<disableFinishedPage>false</disableFinishedPage>
|
||||
<setupLanguages>
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
package com.luoboduner.moo.info;
|
||||
|
||||
import com.formdev.flatlaf.extras.FlatDesktop;
|
||||
import com.formdev.flatlaf.extras.FlatInspector;
|
||||
import com.formdev.flatlaf.extras.FlatUIDefaultsInspector;
|
||||
import com.formdev.flatlaf.util.SystemInfo;
|
||||
import com.luoboduner.moo.info.ui.Init;
|
||||
import com.luoboduner.moo.info.ui.dialog.AboutDialog;
|
||||
import com.luoboduner.moo.info.ui.dialog.SettingDialog;
|
||||
import com.luoboduner.moo.info.ui.form.LoadingForm;
|
||||
import com.luoboduner.moo.info.ui.form.MainWindow;
|
||||
import com.luoboduner.moo.info.ui.frame.MainFrame;
|
||||
import com.luoboduner.moo.info.util.ConfigUtil;
|
||||
import com.luoboduner.moo.info.util.UIUtil;
|
||||
import com.luoboduner.moo.info.util.UpgradeUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
@ -17,6 +25,7 @@ import java.awt.*;
|
|||
* @author <a href="https://github.com/rememberber">RememBerBer</a>
|
||||
* @since 2021/11/07.
|
||||
*/
|
||||
@Slf4j
|
||||
public class App {
|
||||
|
||||
public static ConfigUtil config = ConfigUtil.getInstance();
|
||||
|
@ -32,10 +41,40 @@ public class App {
|
|||
System.setProperty("apple.laf.useScreenMenuBar", "true");
|
||||
System.setProperty("apple.awt.application.name", "MooInfo");
|
||||
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "MooInfo");
|
||||
System.setProperty("apple.awt.application.appearance", "system");
|
||||
if (UIUtil.isDarkLaf()) {
|
||||
System.setProperty("apple.awt.application.appearance", "system");
|
||||
}
|
||||
|
||||
FlatDesktop.setAboutHandler(() -> {
|
||||
try {
|
||||
AboutDialog dialog = new AboutDialog();
|
||||
|
||||
dialog.pack();
|
||||
dialog.setVisible(true);
|
||||
} catch (Exception e2) {
|
||||
log.error(ExceptionUtils.getStackTrace(e2));
|
||||
}
|
||||
});
|
||||
FlatDesktop.setPreferencesHandler(() -> {
|
||||
try {
|
||||
SettingDialog dialog = new SettingDialog();
|
||||
|
||||
dialog.pack();
|
||||
dialog.setVisible(true);
|
||||
} catch (Exception e2) {
|
||||
log.error(ExceptionUtils.getStackTrace(e2));
|
||||
}
|
||||
});
|
||||
FlatDesktop.setQuitHandler(FlatDesktop.QuitResponse::performQuit);
|
||||
|
||||
}
|
||||
|
||||
Init.initTheme();
|
||||
|
||||
// install inspectors
|
||||
FlatInspector.install( "ctrl shift alt X" );
|
||||
FlatUIDefaultsInspector.install( "ctrl shift alt Y" );
|
||||
|
||||
mainFrame = new MainFrame();
|
||||
mainFrame.init();
|
||||
JPanel loadingPanel = new LoadingForm().getLoadingPanel();
|
||||
|
|
|
@ -2,15 +2,20 @@ package com.luoboduner.moo.info.ui;
|
|||
|
||||
import cn.hutool.log.Log;
|
||||
import cn.hutool.log.LogFactory;
|
||||
import com.formdev.flatlaf.FlatDarculaLaf;
|
||||
import com.formdev.flatlaf.FlatDarkLaf;
|
||||
import com.formdev.flatlaf.FlatIntelliJLaf;
|
||||
import com.formdev.flatlaf.FlatLightLaf;
|
||||
import com.formdev.flatlaf.IntelliJTheme;
|
||||
import com.formdev.flatlaf.extras.FlatSVGIcon;
|
||||
import com.formdev.flatlaf.intellijthemes.FlatCyanLightIJTheme;
|
||||
import com.formdev.flatlaf.intellijthemes.FlatDarkPurpleIJTheme;
|
||||
import com.formdev.flatlaf.intellijthemes.FlatLightFlatIJTheme;
|
||||
import com.luoboduner.moo.info.App;
|
||||
import com.luoboduner.moo.info.ui.component.TopMenuBar;
|
||||
import com.luoboduner.moo.info.util.SystemUtil;
|
||||
import com.luoboduner.moo.info.util.UIUtil;
|
||||
import com.luoboduner.moo.info.util.UpgradeUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.FontUIResource;
|
||||
|
@ -83,24 +88,6 @@ public class Init {
|
|||
* init look and feel
|
||||
*/
|
||||
public static void initTheme() {
|
||||
if (SystemUtil.isMacM1() || SystemUtil.isLinuxOs()) {
|
||||
try {
|
||||
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarculaLaf");
|
||||
logger.warn("FlatDarculaLaf theme set.");
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (Exception e2) {
|
||||
logger.error(ExceptionUtils.getStackTrace(e2));
|
||||
}
|
||||
logger.error(ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (App.config.isUnifiedBackground()) {
|
||||
UIManager.put("TitlePane.unifiedBackground", true);
|
||||
}
|
||||
|
||||
try {
|
||||
switch (App.config.getTheme()) {
|
||||
|
@ -108,86 +95,43 @@ public class Init {
|
|||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
break;
|
||||
case "Flat Light":
|
||||
if (SystemUtil.isJBR()) {
|
||||
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||
JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
}
|
||||
FlatLightLaf.install();
|
||||
FlatLightLaf.setup();
|
||||
break;
|
||||
case "Flat IntelliJ":
|
||||
if (SystemUtil.isJBR()) {
|
||||
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||
JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
}
|
||||
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatIntelliJLaf");
|
||||
FlatIntelliJLaf.setup();
|
||||
break;
|
||||
case "Flat Dark":
|
||||
if (SystemUtil.isJBR()) {
|
||||
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||
JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
}
|
||||
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarkLaf");
|
||||
break;
|
||||
case "Darcula":
|
||||
case "Darcula(Recommended)":
|
||||
case "Flat Darcula(Recommended)":
|
||||
if (SystemUtil.isJBR()) {
|
||||
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||
JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
}
|
||||
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarculaLaf");
|
||||
|
||||
UIManager.put("PopupMenu.background", UIManager.getColor("Panel.background"));
|
||||
|
||||
/**
|
||||
If you don't like/want it, you can disable it with:
|
||||
UIManager.put( "TitlePane.useWindowDecorations", false );
|
||||
|
||||
It is also possible to disable only the embedded menu bar (and keep the dark title pane) with:
|
||||
UIManager.put( "TitlePane.menuBarEmbedded", false );
|
||||
|
||||
It is also possible to disable this on command line with following VM options:
|
||||
-Dflatlaf.useWindowDecorations=false
|
||||
-Dflatlaf.menuBarEmbedded=false
|
||||
|
||||
If you have following code in your app, you can remove it (no longer necessary):
|
||||
// enable window decorations
|
||||
JFrame.setDefaultLookAndFeelDecorated( true );
|
||||
JDialog.setDefaultLookAndFeelDecorated( true );
|
||||
**/
|
||||
FlatDarkLaf.setup();
|
||||
break;
|
||||
case "Dark purple":
|
||||
if (SystemUtil.isJBR()) {
|
||||
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||
JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
}
|
||||
IntelliJTheme.setup(App.class.getResourceAsStream(
|
||||
"/theme/DarkPurple.theme.json"));
|
||||
FlatDarkPurpleIJTheme.setup();
|
||||
break;
|
||||
case "IntelliJ Cyan":
|
||||
if (SystemUtil.isJBR()) {
|
||||
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||
JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
}
|
||||
IntelliJTheme.setup(App.class.getResourceAsStream(
|
||||
"/theme/Cyan.theme.json"));
|
||||
FlatCyanLightIJTheme.setup();
|
||||
break;
|
||||
case "IntelliJ Light":
|
||||
if (SystemUtil.isJBR()) {
|
||||
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||
JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
}
|
||||
IntelliJTheme.setup(App.class.getResourceAsStream(
|
||||
"/theme/Light.theme.json"));
|
||||
FlatLightFlatIJTheme.setup();
|
||||
break;
|
||||
|
||||
default:
|
||||
if (SystemUtil.isJBR()) {
|
||||
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||
JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
}
|
||||
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarculaLaf");
|
||||
FlatDarculaLaf.setup();
|
||||
}
|
||||
|
||||
if (UIUtil.isDarkLaf()) {
|
||||
// FlatSVGIcon.ColorFilter.getInstance().setMapper(color -> color.brighter().brighter());
|
||||
} else {
|
||||
FlatSVGIcon.ColorFilter.getInstance().setMapper(color -> color.darker().darker());
|
||||
// SwingUtilities.windowForComponent(App.mainFrame).repaint();
|
||||
}
|
||||
|
||||
if (App.config.isUnifiedBackground()) {
|
||||
UIManager.put("TitlePane.unifiedBackground", true);
|
||||
}
|
||||
|
||||
// top menubar background
|
||||
UIManager.put("PopupMenu.background", UIManager.getColor("Panel.background"));
|
||||
// arrow type
|
||||
UIManager.put("Component.arrowType", "chevron");
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="立即安装"/>
|
||||
<text value="Install Now"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="5723f" class="javax.swing.JButton" binding="buttonCancel">
|
||||
|
@ -42,7 +42,7 @@
|
|||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="取消"/>
|
||||
<text value="Cancel"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="69219" class="javax.swing.JButton" binding="buttonDownloadFromWeb">
|
||||
|
@ -50,7 +50,7 @@
|
|||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="打开下载页面"/>
|
||||
<text value="Open Download Page"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
|
|
|
@ -158,13 +158,13 @@ public class UpdateDialog extends JDialog {
|
|||
panel2.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
|
||||
panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||
buttonOK = new JButton();
|
||||
buttonOK.setText("立即安装");
|
||||
buttonOK.setText("Install Now");
|
||||
panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
buttonCancel = new JButton();
|
||||
buttonCancel.setText("取消");
|
||||
buttonCancel.setText("Cancel");
|
||||
panel2.add(buttonCancel, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
buttonDownloadFromWeb = new JButton();
|
||||
buttonDownloadFromWeb.setText("打开下载页面");
|
||||
buttonDownloadFromWeb.setText("Open Download Page");
|
||||
panel2.add(buttonDownloadFromWeb, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JPanel panel3 = new JPanel();
|
||||
panel3.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="立即下载"/>
|
||||
<text value="Download Now"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="5723f" class="javax.swing.JButton" binding="buttonCancel">
|
||||
|
@ -42,7 +42,7 @@
|
|||
<grid row="0" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="取消"/>
|
||||
<text value="Cancel"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
|
|
|
@ -128,10 +128,10 @@ public class UpdateInfoDialog extends JDialog {
|
|||
panel2.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
|
||||
panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||
buttonOK = new JButton();
|
||||
buttonOK.setText("立即下载");
|
||||
buttonOK.setText("Download Now");
|
||||
panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
buttonCancel = new JButton();
|
||||
buttonCancel.setText("取消");
|
||||
buttonCancel.setText("Cancel");
|
||||
panel2.add(buttonCancel, new GridConstraints(0, 1, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final Spacer spacer2 = new Spacer();
|
||||
panel1.add(spacer2, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
|
||||
|
|
|
@ -59,6 +59,7 @@ public class UIUtil {
|
|||
|| "Darcula(Recommended)".equals(App.config.getTheme())
|
||||
|| "Flat Dark".equals(App.config.getTheme())
|
||||
|| "Flat Darcula".equals(App.config.getTheme())
|
||||
|| "Dark purple".equals(App.config.getTheme())
|
||||
|| "Flat Darcula(Recommended)".equals(App.config.getTheme());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue