diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.form b/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.form
index e75490d..c0703d2 100644
--- a/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.form
+++ b/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.form
@@ -8,7 +8,7 @@
-
+
diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.java b/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.java
index e846552..1e00aa6 100644
--- a/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.java
+++ b/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.java
@@ -6,8 +6,11 @@ import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.core.Spacer;
import com.luoboduner.moo.info.App;
+import com.luoboduner.moo.info.ui.Style;
+import com.luoboduner.moo.info.util.ScrollUtil;
import lombok.Getter;
import oshi.hardware.ComputerSystem;
+import oshi.hardware.HardwareAbstractionLayer;
import oshi.software.os.OperatingSystem;
import javax.swing.*;
@@ -47,6 +50,7 @@ public class DetailForm {
private JLabel powerSourceLabel;
private JLabel sensorsLabel;
private JTextPane sensorsTextPane;
+ private JScrollPane scrollPane;
private static final Log logger = LogFactory.get();
@@ -67,11 +71,24 @@ public class DetailForm {
}
private static void initUi() {
+ DetailForm detailForm = getInstance();
+
+ ScrollUtil.smoothPane(detailForm.scrollPane);
+
+ Style.emphaticTitleFont(detailForm.getOsLabel());
+ Style.emphaticTitleFont(detailForm.getPowerSourceLabel());
+
+ detailForm.getPowerSourceTextPane().setContentType("text/html; charset=utf-8");
}
private static void initInfo() {
+ DetailForm detailForm = getInstance();
+
OperatingSystem operatingSystem = App.si.getOperatingSystem();
- ComputerSystem computerSystem = App.si.getHardware().getComputerSystem();
+ HardwareAbstractionLayer hardware = App.si.getHardware();
+ ComputerSystem computerSystem = hardware.getComputerSystem();
+
+ detailForm.getPowerSourceTextPane().setText(PowerSourceForm.getPowerInfoText(hardware.getPowerSources()));
}
{
@@ -91,12 +108,12 @@ public class DetailForm {
private void $$$setupUI$$$() {
mainPanel = new JPanel();
mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
- final JScrollPane scrollPane1 = new JScrollPane();
- mainPanel.add(scrollPane1, 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));
- scrollPane1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
+ 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));
+ scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(13, 1, new Insets(10, 10, 10, 10), -1, -1));
- scrollPane1.setViewportView(panel1);
+ scrollPane.setViewportView(panel1);
final JPanel panel2 = new JPanel();
panel2.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1));
panel1.add(panel2, 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));
diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.java b/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.java
index b745027..f07b063 100644
--- a/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.java
+++ b/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.java
@@ -130,7 +130,7 @@ public class PowerSourceForm {
}
- private static String getPowerInfoText(List powerSources) {
+ public static String getPowerInfoText(List powerSources) {
StringBuilder powerInfoBuilder = new StringBuilder();
for (PowerSource powerSource : powerSources) {
diff --git a/src/main/java/com/luoboduner/moo/info/util/ScrollUtil.java b/src/main/java/com/luoboduner/moo/info/util/ScrollUtil.java
new file mode 100644
index 0000000..3a3b63d
--- /dev/null
+++ b/src/main/java/com/luoboduner/moo/info/util/ScrollUtil.java
@@ -0,0 +1,19 @@
+package com.luoboduner.moo.info.util;
+
+import javax.swing.*;
+
+/**
+ * some functions about scroll
+ *
+ * @author RememBerBer
+ * @since 2021/11/23.
+ */
+public class ScrollUtil {
+
+ public static void smoothPane(JScrollPane scrollPane) {
+ scrollPane.getVerticalScrollBar().setUnitIncrement(16);
+ scrollPane.getHorizontalScrollBar().setUnitIncrement(16);
+ scrollPane.getVerticalScrollBar().setDoubleBuffered(true);
+ scrollPane.getHorizontalScrollBar().setDoubleBuffered(true);
+ }
+}