oshi first
This commit is contained in:
parent
955caf07c4
commit
ea3b1c8a69
|
@ -7,6 +7,7 @@ import com.formdev.flatlaf.FlatLightLaf;
|
||||||
import com.formdev.flatlaf.IntelliJTheme;
|
import com.formdev.flatlaf.IntelliJTheme;
|
||||||
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.DetailForm;
|
||||||
import com.luoboduner.moo.info.ui.form.NetworkForm;
|
import com.luoboduner.moo.info.ui.form.NetworkForm;
|
||||||
import com.luoboduner.moo.info.ui.form.OverviewForm;
|
import com.luoboduner.moo.info.ui.form.OverviewForm;
|
||||||
import com.luoboduner.moo.info.util.SystemUtil;
|
import com.luoboduner.moo.info.util.SystemUtil;
|
||||||
|
@ -202,6 +203,7 @@ public class Init {
|
||||||
public static void initAllTab() {
|
public static void initAllTab() {
|
||||||
|
|
||||||
ThreadUtil.execute(OverviewForm::init);
|
ThreadUtil.execute(OverviewForm::init);
|
||||||
|
ThreadUtil.execute(DetailForm::init);
|
||||||
ThreadUtil.execute(NetworkForm::init);
|
ThreadUtil.execute(NetworkForm::init);
|
||||||
|
|
||||||
// Check the new version
|
// Check the new version
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?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">
|
||||||
|
<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="9f306">
|
||||||
|
<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="none"/>
|
||||||
|
<children>
|
||||||
|
<grid id="1b97f" 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>
|
||||||
|
<component id="e95b" class="javax.swing.JTree" binding="detailTree">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="150" height="50"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</children>
|
||||||
|
</scrollpane>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</form>
|
|
@ -0,0 +1,110 @@
|
||||||
|
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.tree.DefaultMutableTreeNode;
|
||||||
|
import javax.swing.tree.DefaultTreeModel;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DetailForm
|
||||||
|
*
|
||||||
|
* @author <a href="https://github.com/rememberber">RememBerBer</a>
|
||||||
|
* @since 2021/11/12.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public class DetailForm {
|
||||||
|
private JPanel mainPanel;
|
||||||
|
private JTree detailTree;
|
||||||
|
|
||||||
|
private static final Log logger = LogFactory.get();
|
||||||
|
|
||||||
|
private static DetailForm detailForm;
|
||||||
|
|
||||||
|
public static DetailForm getInstance() {
|
||||||
|
if (detailForm == null) {
|
||||||
|
detailForm = new DetailForm();
|
||||||
|
}
|
||||||
|
return detailForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init() {
|
||||||
|
detailForm = getInstance();
|
||||||
|
|
||||||
|
initUi();
|
||||||
|
initInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void initUi() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void initInfo() {
|
||||||
|
JTree detailTree = getInstance().getDetailTree();
|
||||||
|
DefaultTreeModel defaultTreeModel = new DefaultTreeModel(
|
||||||
|
new DefaultMutableTreeNode("JTree") {
|
||||||
|
{
|
||||||
|
DefaultMutableTreeNode node1 = new DefaultMutableTreeNode("colors");
|
||||||
|
node1.add(new DefaultMutableTreeNode("blue"));
|
||||||
|
node1.add(new DefaultMutableTreeNode("violet"));
|
||||||
|
node1.add(new DefaultMutableTreeNode("red"));
|
||||||
|
node1.add(new DefaultMutableTreeNode("yellow"));
|
||||||
|
add(node1);
|
||||||
|
node1 = new DefaultMutableTreeNode("sports");
|
||||||
|
node1.add(new DefaultMutableTreeNode("basketball"));
|
||||||
|
node1.add(new DefaultMutableTreeNode("soccer"));
|
||||||
|
node1.add(new DefaultMutableTreeNode("football"));
|
||||||
|
node1.add(new DefaultMutableTreeNode("hockey"));
|
||||||
|
add(node1);
|
||||||
|
node1 = new DefaultMutableTreeNode("food");
|
||||||
|
node1.add(new DefaultMutableTreeNode("hot dogs"));
|
||||||
|
DefaultMutableTreeNode node2 = new DefaultMutableTreeNode("pizza");
|
||||||
|
node2.add(new DefaultMutableTreeNode("pizza aglio e olio"));
|
||||||
|
node2.add(new DefaultMutableTreeNode("pizza margherita bianca"));
|
||||||
|
node1.add(node2);
|
||||||
|
node1.add(new DefaultMutableTreeNode("ravioli"));
|
||||||
|
node1.add(new DefaultMutableTreeNode("bananas"));
|
||||||
|
add(node1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
detailTree.setModel(defaultTreeModel);
|
||||||
|
detailTree.setEditable(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// 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));
|
||||||
|
final JPanel panel1 = new JPanel();
|
||||||
|
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1));
|
||||||
|
scrollPane1.setViewportView(panel1);
|
||||||
|
detailTree = new JTree();
|
||||||
|
panel1.add(detailTree, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(150, 50), null, 0, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @noinspection ALL
|
||||||
|
*/
|
||||||
|
public JComponent $$$getRootComponent$$$() {
|
||||||
|
return mainPanel;
|
||||||
|
}
|
||||||
|
}
|
|
@ -28,7 +28,7 @@
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
<children/>
|
<children/>
|
||||||
</grid>
|
</grid>
|
||||||
<grid id="88ee7" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="88ee7" binding="detailPanel" 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="0" left="0" bottom="0" right="0"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<tabbedpane title="Detail"/>
|
<tabbedpane title="Detail"/>
|
||||||
|
|
|
@ -19,6 +19,7 @@ public class MainWindow {
|
||||||
private JPanel mainPanel;
|
private JPanel mainPanel;
|
||||||
private JPanel overviewPanel;
|
private JPanel overviewPanel;
|
||||||
private JPanel networkPanel;
|
private JPanel networkPanel;
|
||||||
|
private JPanel detailPanel;
|
||||||
|
|
||||||
private static MainWindow mainWindow;
|
private static MainWindow mainWindow;
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ public class MainWindow {
|
||||||
public void init() {
|
public void init() {
|
||||||
mainWindow = getInstance();
|
mainWindow = getInstance();
|
||||||
mainWindow.getOverviewPanel().add(OverviewForm.getInstance().getMainPanel(), gridConstraints);
|
mainWindow.getOverviewPanel().add(OverviewForm.getInstance().getMainPanel(), gridConstraints);
|
||||||
|
mainWindow.getDetailPanel().add(DetailForm.getInstance().getMainPanel(), gridConstraints);
|
||||||
mainWindow.getNetworkPanel().add(NetworkForm.getInstance().getMainPanel(), gridConstraints);
|
mainWindow.getNetworkPanel().add(NetworkForm.getInstance().getMainPanel(), gridConstraints);
|
||||||
mainWindow.getMainPanel().updateUI();
|
mainWindow.getMainPanel().updateUI();
|
||||||
}
|
}
|
||||||
|
@ -64,30 +66,30 @@ public class MainWindow {
|
||||||
overviewPanel = new JPanel();
|
overviewPanel = new JPanel();
|
||||||
overviewPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
overviewPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
tabbedPane.addTab("Overview", overviewPanel);
|
tabbedPane.addTab("Overview", overviewPanel);
|
||||||
|
detailPanel = new JPanel();
|
||||||
|
detailPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
|
tabbedPane.addTab("Detail", detailPanel);
|
||||||
final JPanel panel1 = new JPanel();
|
final JPanel panel1 = new JPanel();
|
||||||
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
tabbedPane.addTab("Detail", panel1);
|
tabbedPane.addTab("Memory", panel1);
|
||||||
final JPanel panel2 = new JPanel();
|
final JPanel panel2 = new JPanel();
|
||||||
panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
tabbedPane.addTab("Memory", panel2);
|
tabbedPane.addTab("CPU", panel2);
|
||||||
final JPanel panel3 = new JPanel();
|
final JPanel panel3 = new JPanel();
|
||||||
panel3.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
panel3.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
tabbedPane.addTab("CPU", panel3);
|
tabbedPane.addTab("Disk", panel3);
|
||||||
final JPanel panel4 = new JPanel();
|
|
||||||
panel4.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
|
||||||
tabbedPane.addTab("Disk", panel4);
|
|
||||||
networkPanel = new JPanel();
|
networkPanel = new JPanel();
|
||||||
networkPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
networkPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
tabbedPane.addTab("Network", networkPanel);
|
tabbedPane.addTab("Network", networkPanel);
|
||||||
|
final JPanel panel4 = new JPanel();
|
||||||
|
panel4.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
|
tabbedPane.addTab("Variables", panel4);
|
||||||
final JPanel panel5 = new JPanel();
|
final JPanel panel5 = new JPanel();
|
||||||
panel5.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
panel5.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
tabbedPane.addTab("Variables", panel5);
|
tabbedPane.addTab("Processes", panel5);
|
||||||
final JPanel panel6 = new JPanel();
|
final JPanel panel6 = new JPanel();
|
||||||
panel6.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
panel6.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
tabbedPane.addTab("Processes", panel6);
|
tabbedPane.addTab("USB Devices", panel6);
|
||||||
final JPanel panel7 = new JPanel();
|
|
||||||
panel7.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
|
||||||
tabbedPane.addTab("USB Devices", panel7);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OverviewForm
|
* NetworkForm
|
||||||
*
|
*
|
||||||
* @author <a href="https://github.com/rememberber">RememBerBer</a>
|
* @author <a href="https://github.com/rememberber">RememBerBer</a>
|
||||||
* @since 2021/11/12.
|
* @since 2021/11/12.
|
||||||
|
|
Loading…
Reference in New Issue