Merge pull request #6 from rememberber/dev

Dev
This commit is contained in:
周波 2022-01-14 20:39:43 +08:00 committed by GitHub
commit 8f9b4e8743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 54 additions and 40 deletions

View File

@ -6,7 +6,7 @@
<groupId>com.luoboduner.moo.info</groupId> <groupId>com.luoboduner.moo.info</groupId>
<artifactId>MooInfo</artifactId> <artifactId>MooInfo</artifactId>
<version>1.1.0</version> <version>1.1.1</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>MooInfo</name> <name>MooInfo</name>
@ -26,11 +26,11 @@
<commons-lang3.version>3.12.0</commons-lang3.version> <commons-lang3.version>3.12.0</commons-lang3.version>
<guava.version>31.0.1-jre</guava.version> <guava.version>31.0.1-jre</guava.version>
<okhttp.version>4.9.3</okhttp.version> <okhttp.version>4.9.3</okhttp.version>
<flatlaf.version>2.0-rc1</flatlaf.version> <flatlaf.version>2.0</flatlaf.version>
<flatlaf-extras.version>2.0-rc1</flatlaf-extras.version> <flatlaf-extras.version>2.0</flatlaf-extras.version>
<hutool-all.version>5.7.16</hutool-all.version> <hutool-all.version>5.7.16</hutool-all.version>
<fastjson.version>1.2.78</fastjson.version> <fastjson.version>1.2.78</fastjson.version>
<oshi-core.version>5.8.6</oshi-core.version> <oshi-core.version>6.0.0</oshi-core.version>
<jfreechart.version>1.5.3</jfreechart.version> <jfreechart.version>1.5.3</jfreechart.version>
</properties> </properties>

View File

@ -9,6 +9,7 @@ import com.luoboduner.moo.info.ui.form.LoadingForm;
import com.luoboduner.moo.info.ui.form.MainWindow; import com.luoboduner.moo.info.ui.form.MainWindow;
import com.luoboduner.moo.info.ui.frame.MainFrame; import com.luoboduner.moo.info.ui.frame.MainFrame;
import com.luoboduner.moo.info.util.ConfigUtil; import com.luoboduner.moo.info.util.ConfigUtil;
import com.luoboduner.moo.info.util.UIUtil;
import com.luoboduner.moo.info.util.UpgradeUtil; import com.luoboduner.moo.info.util.UpgradeUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
@ -39,7 +40,9 @@ public class App {
System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("apple.awt.application.name", "MooInfo"); System.setProperty("apple.awt.application.name", "MooInfo");
System.setProperty("com.apple.mrj.application.apple.menu.about.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(() -> { FlatDesktop.setAboutHandler(() -> {
try { try {
@ -90,7 +93,6 @@ public class App {
MainWindow.getInstance().init(); MainWindow.getInstance().init();
Init.initAllTab(); Init.initAllTab();
Init.initOthers(); Init.initOthers();
mainFrame.addListeners();
mainFrame.remove(loadingPanel); mainFrame.remove(loadingPanel);
} }
} }

View File

@ -5,6 +5,7 @@ import cn.hutool.log.Log;
import cn.hutool.log.LogFactory; import cn.hutool.log.LogFactory;
import com.formdev.flatlaf.FlatLightLaf; import com.formdev.flatlaf.FlatLightLaf;
import com.formdev.flatlaf.IntelliJTheme; import com.formdev.flatlaf.IntelliJTheme;
import com.formdev.flatlaf.extras.FlatSVGIcon;
import com.luoboduner.moo.info.App; import com.luoboduner.moo.info.App;
import com.luoboduner.moo.info.ui.component.TopMenuBar; import com.luoboduner.moo.info.ui.component.TopMenuBar;
import com.luoboduner.moo.info.ui.form.*; import com.luoboduner.moo.info.ui.form.*;
@ -190,6 +191,12 @@ public class Init {
} }
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarculaLaf"); UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarculaLaf");
} }
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();
} catch (Exception e) { } catch (Exception e) {
logger.error(e); logger.error(e);
} }

View File

@ -11,7 +11,7 @@ import java.awt.*;
public class UiConsts { public class UiConsts {
public static final String APP_NAME = "MooInfo"; public static final String APP_NAME = "MooInfo";
public static final String APP_VERSION = "1.1.0"; public static final String APP_VERSION = "1.1.1";
public static final int TABLE_ROW_HEIGHT = 36; public static final int TABLE_ROW_HEIGHT = 36;

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.luoboduner.moo.info.ui.dialog.AboutDialog"> <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.luoboduner.moo.info.ui.dialog.AboutDialog">
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="20" left="20" bottom="20" right="20"/>
<constraints> <constraints>
<xy x="48" y="54" width="911" height="1381"/> <xy x="48" y="54" width="911" height="1381"/>
</constraints> </constraints>
@ -16,7 +16,7 @@
<border type="empty"/> <border type="empty"/>
<children> <children>
<grid id="3215c" layout-manager="GridLayoutManager" row-count="9" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="3215c" layout-manager="GridLayoutManager" row-count="9" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="40" left="40" bottom="40" right="0"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints/> <constraints/>
<properties/> <properties/>
<border type="empty"/> <border type="empty"/>

View File

@ -43,7 +43,7 @@ public class AboutDialog extends JDialog {
public AboutDialog() { public AboutDialog() {
super(App.mainFrame, "About"); super(App.mainFrame, "About");
ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.4, 0.64); ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.5, 0.64);
setContentPane(contentPane); setContentPane(contentPane);
setModal(true); setModal(true);
@ -354,12 +354,12 @@ public class AboutDialog extends JDialog {
*/ */
private void $$$setupUI$$$() { private void $$$setupUI$$$() {
contentPane = new JPanel(); contentPane = new JPanel();
contentPane.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPane.setLayout(new GridLayoutManager(1, 1, new Insets(20, 20, 20, 20), -1, -1));
scrollPane = new JScrollPane(); scrollPane = new JScrollPane();
contentPane.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); contentPane.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
final JPanel panel1 = new JPanel(); final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(9, 2, new Insets(40, 40, 40, 0), -1, -1)); panel1.setLayout(new GridLayoutManager(9, 2, new Insets(0, 0, 0, 0), -1, -1));
scrollPane.setViewportView(panel1); scrollPane.setViewportView(panel1);
panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
logoLabel = new JLabel(); logoLabel = new JLabel();

View File

@ -33,7 +33,7 @@ public class SystemInfoTestDialog extends JDialog {
public SystemInfoTestDialog() { public SystemInfoTestDialog() {
super(App.mainFrame, "System Info Test"); super(App.mainFrame, "System Info Test");
ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.6, 0.64); ComponentUtil.setPreferSizeAndLocateToCenter(this, App.mainFrame.getWidth(), App.mainFrame.getHeight());
setContentPane(contentPane); setContentPane(contentPane);
setModal(true); setModal(true);
getRootPane().setDefaultButton(buttonOK); getRootPane().setDefaultButton(buttonOK);

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.luoboduner.moo.info.ui.form.DetailForm"> <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.luoboduner.moo.info.ui.form.DetailForm">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="10" left="10" bottom="10" right="10"/>
<constraints> <constraints>
<xy x="20" y="20" width="500" height="1011"/> <xy x="20" y="20" width="500" height="1011"/>
</constraints> </constraints>
@ -16,7 +16,7 @@
<border type="empty"/> <border type="empty"/>
<children> <children>
<grid id="1b97f" layout-manager="GridLayoutManager" row-count="12" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="1b97f" layout-manager="GridLayoutManager" row-count="12" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints/> <constraints/>
<properties/> <properties/>
<border type="none"/> <border type="none"/>

View File

@ -307,12 +307,12 @@ public class DetailForm {
*/ */
private void $$$setupUI$$$() { private void $$$setupUI$$$() {
mainPanel = new JPanel(); mainPanel = new JPanel();
mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1));
scrollPane = new JScrollPane(); scrollPane = new JScrollPane();
mainPanel.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); mainPanel.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
final JPanel panel1 = new JPanel(); final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(12, 1, new Insets(10, 10, 10, 10), -1, -1)); panel1.setLayout(new GridLayoutManager(12, 1, new Insets(0, 0, 0, 0), -1, -1));
scrollPane.setViewportView(panel1); scrollPane.setViewportView(panel1);
final JPanel panel2 = new JPanel(); final JPanel panel2 = new JPanel();
panel2.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); panel2.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1));

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.luoboduner.moo.info.ui.form.DiskForm"> <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.luoboduner.moo.info.ui.form.DiskForm">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="10" left="10" bottom="10" right="10"/>
<constraints> <constraints>
<xy x="20" y="20" width="500" height="400"/> <xy x="20" y="20" width="500" height="400"/>
</constraints> </constraints>
@ -24,7 +24,7 @@
<border type="empty"/> <border type="empty"/>
<children> <children>
<grid id="959a9" binding="diskListPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="959a9" binding="diskListPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="10" bottom="0" right="10"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints/> <constraints/>
<properties/> <properties/>
<border type="none"/> <border type="none"/>

View File

@ -128,7 +128,7 @@ public class DiskForm {
*/ */
private void $$$setupUI$$$() { private void $$$setupUI$$$() {
mainPanel = new JPanel(); mainPanel = new JPanel();
mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1));
final JPanel panel1 = new JPanel(); final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1)); panel1.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1));
mainPanel.add(panel1, new GridConstraints(0, 0, 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)); mainPanel.add(panel1, new GridConstraints(0, 0, 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));
@ -136,7 +136,7 @@ public class DiskForm {
panel1.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); panel1.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
diskListPanel = new JPanel(); diskListPanel = new JPanel();
diskListPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 10, 0, 10), -1, -1)); diskListPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
scrollPane.setViewportView(diskListPanel); scrollPane.setViewportView(diskListPanel);
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.luoboduner.moo.info.ui.form.OverviewForm"> <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.luoboduner.moo.info.ui.form.OverviewForm">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="10" left="10" bottom="10" right="10"/>
<constraints> <constraints>
<xy x="20" y="20" width="500" height="635"/> <xy x="20" y="20" width="500" height="635"/>
</constraints> </constraints>
@ -16,7 +16,7 @@
<border type="empty"/> <border type="empty"/>
<children> <children>
<grid id="e4c5c" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="e4c5c" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints/> <constraints/>
<properties/> <properties/>
<border type="none"/> <border type="none"/>

View File

@ -334,12 +334,12 @@ public class OverviewForm {
*/ */
private void $$$setupUI$$$() { private void $$$setupUI$$$() {
mainPanel = new JPanel(); mainPanel = new JPanel();
mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1));
scrollPane = new JScrollPane(); scrollPane = new JScrollPane();
mainPanel.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); mainPanel.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
final JPanel panel1 = new JPanel(); final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(4, 1, new Insets(10, 10, 10, 10), -1, -1)); panel1.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1));
scrollPane.setViewportView(panel1); scrollPane.setViewportView(panel1);
final JPanel panel2 = new JPanel(); final JPanel panel2 = new JPanel();
panel2.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); panel2.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1));

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.luoboduner.moo.info.ui.form.PowerSourceForm"> <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.luoboduner.moo.info.ui.form.PowerSourceForm">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="10" left="10" bottom="10" right="10"/>
<constraints> <constraints>
<xy x="20" y="20" width="500" height="400"/> <xy x="20" y="20" width="500" height="400"/>
</constraints> </constraints>
@ -16,7 +16,7 @@
<border type="empty"/> <border type="empty"/>
<children> <children>
<grid id="baebb" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="baebb" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints/> <constraints/>
<properties/> <properties/>
<border type="none"/> <border type="none"/>

View File

@ -79,7 +79,9 @@ public class PowerSourceForm {
powerNameBuilder.append(powerSource.getName()); powerNameBuilder.append(powerSource.getName());
powerNameBuilder.append(" ").append(powerSource.getManufacturer()); powerNameBuilder.append(" ").append(powerSource.getManufacturer());
powerNameBuilder.append(" ").append(powerSource.getDeviceName()); powerNameBuilder.append(" ").append(powerSource.getDeviceName());
powerNameBuilder.append(" ").append(powerSource.getChemistry()); if (!"unknown".equals(powerSource.getChemistry())) {
powerNameBuilder.append(" ").append(powerSource.getChemistry());
}
powerNameLabel.setText(powerNameBuilder.toString()); powerNameLabel.setText(powerNameBuilder.toString());
powerPanel.add(powerNameLabel, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); powerPanel.add(powerNameLabel, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
@ -100,7 +102,8 @@ public class PowerSourceForm {
capacityBuilder.append("Current ").append(powerSource.getCurrentCapacity()); capacityBuilder.append("Current ").append(powerSource.getCurrentCapacity());
capacityBuilder.append(" / ").append("Max ").append(powerSource.getMaxCapacity()); capacityBuilder.append(" / ").append("Max ").append(powerSource.getMaxCapacity());
capacityBuilder.append(" / ").append("Design ").append(powerSource.getDesignCapacity()); capacityBuilder.append(" / ").append("Design ").append(powerSource.getDesignCapacity());
capacityBuilder.append(" (").append(powerSource.getCapacityUnits()).append(")"); capacityBuilder.append(" (").append(powerSource.getCapacityUnits()).append(") ");
capacityBuilder.append((powerSource.getDesignCapacity() - powerSource.getMaxCapacity()) * 100 / powerSource.getDesignCapacity()).append("% wastage");
capacityLabel.setText(capacityBuilder.toString()); capacityLabel.setText(capacityBuilder.toString());
powerPanel.add(capacityLabel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); powerPanel.add(capacityLabel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
@ -205,12 +208,12 @@ public class PowerSourceForm {
*/ */
private void $$$setupUI$$$() { private void $$$setupUI$$$() {
mainPanel = new JPanel(); mainPanel = new JPanel();
mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1));
scrollPane = new JScrollPane(); scrollPane = new JScrollPane();
mainPanel.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); mainPanel.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
final JPanel panel1 = new JPanel(); final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); panel1.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
scrollPane.setViewportView(panel1); scrollPane.setViewportView(panel1);
powerBasePanel = new JPanel(); powerBasePanel = new JPanel();
powerBasePanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); powerBasePanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

View File

@ -1,6 +1,5 @@
package com.luoboduner.moo.info.ui.frame; package com.luoboduner.moo.info.ui.frame;
import cn.hutool.core.thread.ThreadUtil;
import com.formdev.flatlaf.extras.FlatSVGUtils; import com.formdev.flatlaf.extras.FlatSVGUtils;
import com.luoboduner.moo.info.ui.UiConsts; import com.luoboduner.moo.info.ui.UiConsts;
import com.luoboduner.moo.info.ui.component.TopMenuBar; import com.luoboduner.moo.info.ui.component.TopMenuBar;
@ -26,12 +25,8 @@ public class MainFrame extends JFrame {
topMenuBar.init(); topMenuBar.init();
setJMenuBar(topMenuBar); setJMenuBar(topMenuBar);
ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.6, 0.8); ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.6, 0.8);
FrameListener.addListeners();
} }
/**
* add event listeners
*/
public void addListeners() {
ThreadUtil.execute(FrameListener::addListeners);
}
} }

View File

@ -59,6 +59,7 @@ public class UIUtil {
|| "Darcula(Recommended)".equals(App.config.getTheme()) || "Darcula(Recommended)".equals(App.config.getTheme())
|| "Flat Dark".equals(App.config.getTheme()) || "Flat Dark".equals(App.config.getTheme())
|| "Flat Darcula".equals(App.config.getTheme()) || "Flat Darcula".equals(App.config.getTheme())
|| "Dark purple".equals(App.config.getTheme())
|| "Flat Darcula(Recommended)".equals(App.config.getTheme()); || "Flat Darcula(Recommended)".equals(App.config.getTheme());
} }
} }

View File

@ -1,9 +1,10 @@
{ {
"currentVersion": "1.1.0", "currentVersion": "1.1.1",
"versionIndex": { "versionIndex": {
"0.0.0": "0", "0.0.0": "0",
"1.0.0": "1", "1.0.0": "1",
"1.1.0": "2" "1.1.0": "2",
"1.1.1": "3"
}, },
"versionDetailList": [ "versionDetailList": [
{ {
@ -20,6 +21,11 @@
"version": "1.1.0", "version": "1.1.0",
"title": "Some minor features and optimizations", "title": "Some minor features and optimizations",
"log": "● update oshi-core to 5.8.6\n● update flatlaf to 2.0-rc1(Support Windows 11 snap layouts menu, macOS screen menu optimization)\n● processes sort method added same as the oshi's demo\n● add cpu usage chart\n● make System Boot Time and Uptime readable\n● add System Info Test function menu same as oshi-core\n" "log": "● update oshi-core to 5.8.6\n● update flatlaf to 2.0-rc1(Support Windows 11 snap layouts menu, macOS screen menu optimization)\n● processes sort method added same as the oshi's demo\n● add cpu usage chart\n● make System Boot Time and Uptime readable\n● add System Info Test function menu same as oshi-core\n"
},
{
"version": "1.1.1",
"title": "update flatlaf to 2.0",
"log": "● update flatlaf to 2.0\n● update oshi-core to 6.0.0\n● add battery wastage indicator\n● optimization of light theme\n"
} }
] ]
} }