power form added

This commit is contained in:
rememberber 2021-11-21 17:50:37 +08:00
parent 2ce3be8317
commit 61c897308a
5 changed files with 117 additions and 0 deletions

View File

@ -209,6 +209,7 @@ public class Init {
ThreadUtil.execute(VariablesForm::init);
ThreadUtil.execute(ProcessesForm::init);
ThreadUtil.execute(DiskForm::init);
ThreadUtil.execute(PowerSourceForm::init);
// Check the new version
if (App.config.isAutoCheckUpdate()) {

View File

@ -100,6 +100,15 @@
<border type="none"/>
<children/>
</grid>
<grid id="929fa" binding="powerPanel" 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"/>
<constraints>
<tabbedpane title="Power"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</grid>
</children>
</tabbedpane>
</children>

View File

@ -26,6 +26,7 @@ public class MainWindow {
private JPanel diskPanel;
private JPanel memoryPanel;
private JPanel cpuPanel;
private JPanel powerPanel;
private static MainWindow mainWindow;
@ -52,6 +53,7 @@ public class MainWindow {
mainWindow.getVariablesPanel().add(VariablesForm.getInstance().getMainPanel(), gridConstraints);
mainWindow.getProcessesPanel().add(ProcessesForm.getInstance().getMainPanel(), gridConstraints);
mainWindow.getDiskPanel().add(DiskForm.getInstance().getMainPanel(), gridConstraints);
mainWindow.getPowerPanel().add(PowerSourceForm.getInstance().getMainPanel(), gridConstraints);
mainWindow.getMainPanel().updateUI();
}
@ -102,6 +104,9 @@ public class MainWindow {
usbPanel = new JPanel();
usbPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
tabbedPane.addTab("USB Devices", usbPanel);
powerPanel = new JPanel();
powerPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
tabbedPane.addTab("Power", powerPanel);
}
/**

View File

@ -0,0 +1,29 @@
<?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">
<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"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<scrollpane id="6ac81">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="empty"/>
<children>
<grid id="baebb" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints/>
<properties/>
<border type="none"/>
<children/>
</grid>
</children>
</scrollpane>
</children>
</grid>
</form>

View File

@ -0,0 +1,73 @@
package com.luoboduner.moo.info.ui.form;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;
import lombok.Getter;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import java.awt.*;
/**
* NetworkForm
*
* @author <a href="https://github.com/rememberber">RememBerBer</a>
* @since 2021/11/21.
*/
@Getter
public class PowerSourceForm {
private JPanel mainPanel;
private static final Log logger = LogFactory.get();
private static PowerSourceForm powerSourceForm;
public static PowerSourceForm getInstance() {
if (powerSourceForm == null) {
powerSourceForm = new PowerSourceForm();
}
return powerSourceForm;
}
public static void init() {
powerSourceForm = getInstance();
// initUi();
// initInfo();
}
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$();
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
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));
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1));
scrollPane1.setViewportView(panel1);
}
/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return mainPanel;
}
}