cpu and memory form added
This commit is contained in:
parent
e14fbd705c
commit
d4fbeb1fb8
4
pom.xml
4
pom.xml
|
@ -27,8 +27,8 @@
|
||||||
<commons-lang3.version>3.11</commons-lang3.version>
|
<commons-lang3.version>3.11</commons-lang3.version>
|
||||||
<guava.version>29.0-jre</guava.version>
|
<guava.version>29.0-jre</guava.version>
|
||||||
<okhttp.version>4.9.0</okhttp.version>
|
<okhttp.version>4.9.0</okhttp.version>
|
||||||
<flatlaf.version>1.6.3</flatlaf.version>
|
<flatlaf.version>1.6.4</flatlaf.version>
|
||||||
<flatlaf-extras.version>1.6.3</flatlaf-extras.version>
|
<flatlaf-extras.version>1.6.4</flatlaf-extras.version>
|
||||||
<hutool-all.version>5.6.3</hutool-all.version>
|
<hutool-all.version>5.6.3</hutool-all.version>
|
||||||
<fastjson.version>1.2.74</fastjson.version>
|
<fastjson.version>1.2.74</fastjson.version>
|
||||||
<oshi-core.version>5.8.3</oshi-core.version>
|
<oshi-core.version>5.8.3</oshi-core.version>
|
||||||
|
|
|
@ -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.MemoryForm">
|
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.luoboduner.moo.info.ui.form.MemoryForm">
|
||||||
<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>
|
||||||
|
@ -13,37 +13,37 @@
|
||||||
<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"/>
|
<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>
|
</constraints>
|
||||||
<properties/>
|
<properties/>
|
||||||
<border type="none"/>
|
<border type="empty"/>
|
||||||
<children>
|
<children>
|
||||||
<grid id="bbcf8" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="bbcf8" layout-manager="GridLayoutManager" row-count="4" 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/>
|
||||||
<properties/>
|
<properties/>
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
<children>
|
<children>
|
||||||
<grid id="43961" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="43961" layout-manager="GridLayoutManager" row-count="3" column-count="3" 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>
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties/>
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
<children>
|
<children>
|
||||||
<component id="32bfb" class="javax.swing.JLabel" binding="pysicalMemoryTitle">
|
<component id="32bfb" class="javax.swing.JLabel" binding="physicalMemoryTitle">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value="Pysical Memory"/>
|
<text value="Physical Memory"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="20763" class="javax.swing.JProgressBar" binding="pysicalMemoryProgressBar">
|
<component id="20763" class="javax.swing.JProgressBar" binding="physicalMemoryProgressBar">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="1" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
<grid row="1" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties/>
|
||||||
</component>
|
</component>
|
||||||
<component id="bee7b" class="javax.swing.JLabel" binding="pysicalMemoryUsed">
|
<component id="bee7b" class="javax.swing.JLabel" binding="physicalMemoryUsed">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
<text value="Used -"/>
|
<text value="Used -"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="78b56" class="javax.swing.JLabel" binding="pysicalMemoryAvailable">
|
<component id="78b56" class="javax.swing.JLabel" binding="physicalMemoryAvailable">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
<grid id="b3163" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="b3163" layout-manager="GridLayoutManager" row-count="3" column-count="3" 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>
|
||||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value="Virtual Memory(Swap)"/>
|
<text value="Virtual Memory"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="46f6d" class="javax.swing.JProgressBar" binding="virtualMemoryProgressBar">
|
<component id="46f6d" class="javax.swing.JProgressBar" binding="virtualMemoryProgressBar">
|
||||||
|
@ -111,9 +111,54 @@
|
||||||
</hspacer>
|
</hspacer>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
|
<grid id="2502c" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="10" left="10" bottom="10" right="10"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<component id="b6a80" class="javax.swing.JLabel" binding="swapTitle">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Swap"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="b50df" class="javax.swing.JProgressBar" binding="swapProgressBar">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
<component id="d2df6" class="javax.swing.JLabel" binding="swapUsedLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Used -"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="e5b9e" class="javax.swing.JLabel" binding="swapAvailableLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="- Available"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<hspacer id="77e8f">
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
</hspacer>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
<vspacer id="d87ac">
|
<vspacer id="d87ac">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</vspacer>
|
</vspacer>
|
||||||
</children>
|
</children>
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
package com.luoboduner.moo.info.ui.form;
|
package com.luoboduner.moo.info.ui.form;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.unit.DataSizeUtil;
|
||||||
import cn.hutool.log.Log;
|
import cn.hutool.log.Log;
|
||||||
import cn.hutool.log.LogFactory;
|
import cn.hutool.log.LogFactory;
|
||||||
import com.intellij.uiDesigner.core.GridConstraints;
|
import com.intellij.uiDesigner.core.GridConstraints;
|
||||||
import com.intellij.uiDesigner.core.GridLayoutManager;
|
import com.intellij.uiDesigner.core.GridLayoutManager;
|
||||||
import com.intellij.uiDesigner.core.Spacer;
|
import com.intellij.uiDesigner.core.Spacer;
|
||||||
import com.luoboduner.moo.info.App;
|
import com.luoboduner.moo.info.App;
|
||||||
|
import com.luoboduner.moo.info.ui.UiConsts;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import oshi.hardware.GlobalMemory;
|
import oshi.hardware.GlobalMemory;
|
||||||
import oshi.hardware.PhysicalMemory;
|
import oshi.hardware.PhysicalMemory;
|
||||||
import oshi.hardware.VirtualMemory;
|
import oshi.hardware.VirtualMemory;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import javax.swing.border.TitledBorder;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -27,14 +30,18 @@ public class MemoryForm {
|
||||||
|
|
||||||
private static MemoryForm memoryForm;
|
private static MemoryForm memoryForm;
|
||||||
private JPanel mainPanel;
|
private JPanel mainPanel;
|
||||||
private JProgressBar pysicalMemoryProgressBar;
|
private JProgressBar physicalMemoryProgressBar;
|
||||||
private JProgressBar virtualMemoryProgressBar;
|
private JProgressBar virtualMemoryProgressBar;
|
||||||
private JLabel pysicalMemoryTitle;
|
private JLabel physicalMemoryTitle;
|
||||||
private JLabel pysicalMemoryUsed;
|
private JLabel physicalMemoryUsed;
|
||||||
private JLabel pysicalMemoryAvailable;
|
private JLabel physicalMemoryAvailable;
|
||||||
private JLabel virtualMemoryTitle;
|
private JLabel virtualMemoryTitle;
|
||||||
private JLabel virtualMemoryUsed;
|
private JLabel virtualMemoryUsed;
|
||||||
private JLabel virtualMemoryAvailable;
|
private JLabel virtualMemoryAvailable;
|
||||||
|
private JLabel swapUsedLabel;
|
||||||
|
private JProgressBar swapProgressBar;
|
||||||
|
private JLabel swapAvailableLabel;
|
||||||
|
private JLabel swapTitle;
|
||||||
|
|
||||||
public static MemoryForm getInstance() {
|
public static MemoryForm getInstance() {
|
||||||
if (memoryForm == null) {
|
if (memoryForm == null) {
|
||||||
|
@ -47,17 +54,61 @@ public class MemoryForm {
|
||||||
memoryForm = getInstance();
|
memoryForm = getInstance();
|
||||||
|
|
||||||
initUi();
|
initUi();
|
||||||
|
Timer timer = new Timer(UiConsts.REFRESH_FAST, e -> {
|
||||||
initInfo();
|
initInfo();
|
||||||
|
});
|
||||||
|
timer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initUi() {
|
private static void initUi() {
|
||||||
|
MemoryForm memoryForm = getInstance();
|
||||||
|
JPanel mainPanel = memoryForm.getMainPanel();
|
||||||
|
Font emphaticFont = new Font(mainPanel.getFont().getName(), Font.BOLD, mainPanel.getFont().getSize() + 2);
|
||||||
|
memoryForm.getPhysicalMemoryTitle().setFont(emphaticFont);
|
||||||
|
memoryForm.getVirtualMemoryTitle().setFont(emphaticFont);
|
||||||
|
memoryForm.getSwapTitle().setFont(emphaticFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initInfo() {
|
private static void initInfo() {
|
||||||
GlobalMemory memory = App.si.getHardware().getMemory();
|
GlobalMemory memory = App.si.getHardware().getMemory();
|
||||||
|
|
||||||
List<PhysicalMemory> physicalMemory = memory.getPhysicalMemory();
|
// global memory
|
||||||
|
long total = memory.getTotal();
|
||||||
|
long available = memory.getAvailable();
|
||||||
|
MemoryForm memoryForm = getInstance();
|
||||||
|
JProgressBar physicalMemoryProgressBar = memoryForm.getPhysicalMemoryProgressBar();
|
||||||
|
physicalMemoryProgressBar.setMaximum(100);
|
||||||
|
int usagePercent = (int) ((total - available) * 100 / total);
|
||||||
|
physicalMemoryProgressBar.setValue(usagePercent);
|
||||||
|
physicalMemoryProgressBar.setToolTipText(usagePercent + "%");
|
||||||
|
|
||||||
|
memoryForm.getPhysicalMemoryUsed().setText("Used " + DataSizeUtil.format(total - available) + "/" + DataSizeUtil.format(total));
|
||||||
|
memoryForm.getPhysicalMemoryAvailable().setText(DataSizeUtil.format(available) + "/" + DataSizeUtil.format(total) + " Available");
|
||||||
|
|
||||||
|
// virtual memory
|
||||||
VirtualMemory virtualMemory = memory.getVirtualMemory();
|
VirtualMemory virtualMemory = memory.getVirtualMemory();
|
||||||
|
long virtualMax = virtualMemory.getVirtualMax();
|
||||||
|
long virtualInUse = virtualMemory.getVirtualInUse();
|
||||||
|
JProgressBar virtualMemoryProgressBar = memoryForm.getVirtualMemoryProgressBar();
|
||||||
|
virtualMemoryProgressBar.setMaximum(100);
|
||||||
|
int virtualUsagePercent = (int) (virtualInUse * 100 / virtualMax);
|
||||||
|
virtualMemoryProgressBar.setValue(virtualUsagePercent);
|
||||||
|
virtualMemoryProgressBar.setToolTipText(virtualUsagePercent + "%");
|
||||||
|
memoryForm.getVirtualMemoryUsed().setText("Used " + DataSizeUtil.format(virtualInUse) + "/" + DataSizeUtil.format(virtualMax));
|
||||||
|
memoryForm.getVirtualMemoryAvailable().setText(DataSizeUtil.format(virtualMax - virtualInUse) + "/" + DataSizeUtil.format(virtualMax) + " Available");
|
||||||
|
|
||||||
|
// swap memory
|
||||||
|
long swapTotal = virtualMemory.getSwapTotal();
|
||||||
|
long swapUsed = virtualMemory.getSwapUsed();
|
||||||
|
JProgressBar swapProgressBar = memoryForm.getSwapProgressBar();
|
||||||
|
swapProgressBar.setMaximum(100);
|
||||||
|
int swapUsagePercent = (int) (swapUsed * 100 / swapTotal);
|
||||||
|
swapProgressBar.setValue(swapUsagePercent);
|
||||||
|
swapProgressBar.setToolTipText(swapUsagePercent + "%");
|
||||||
|
memoryForm.getSwapUsedLabel().setText("Used " + DataSizeUtil.format(swapUsed) + "/" + DataSizeUtil.format(swapTotal));
|
||||||
|
memoryForm.getSwapAvailableLabel().setText(DataSizeUtil.format(swapTotal - swapUsed) + "/" + DataSizeUtil.format(swapTotal) + " Available");
|
||||||
|
|
||||||
|
List<PhysicalMemory> physicalMemory = memory.getPhysicalMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -76,33 +127,34 @@ public class MemoryForm {
|
||||||
*/
|
*/
|
||||||
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 JScrollPane scrollPane1 = new JScrollPane();
|
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));
|
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();
|
final JPanel panel1 = new JPanel();
|
||||||
panel1.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1));
|
panel1.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
scrollPane1.setViewportView(panel1);
|
scrollPane1.setViewportView(panel1);
|
||||||
final JPanel panel2 = new JPanel();
|
final JPanel panel2 = new JPanel();
|
||||||
panel2.setLayout(new GridLayoutManager(3, 3, new Insets(0, 0, 0, 0), -1, -1));
|
panel2.setLayout(new GridLayoutManager(3, 3, 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));
|
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));
|
||||||
pysicalMemoryTitle = new JLabel();
|
physicalMemoryTitle = new JLabel();
|
||||||
pysicalMemoryTitle.setText("Pysical Memory");
|
physicalMemoryTitle.setText("Physical Memory");
|
||||||
panel2.add(pysicalMemoryTitle, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
panel2.add(physicalMemoryTitle, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
pysicalMemoryProgressBar = new JProgressBar();
|
physicalMemoryProgressBar = new JProgressBar();
|
||||||
panel2.add(pysicalMemoryProgressBar, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
panel2.add(physicalMemoryProgressBar, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
pysicalMemoryUsed = new JLabel();
|
physicalMemoryUsed = new JLabel();
|
||||||
pysicalMemoryUsed.setText("Used -");
|
physicalMemoryUsed.setText("Used -");
|
||||||
panel2.add(pysicalMemoryUsed, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
panel2.add(physicalMemoryUsed, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
pysicalMemoryAvailable = new JLabel();
|
physicalMemoryAvailable = new JLabel();
|
||||||
pysicalMemoryAvailable.setText("- Available");
|
physicalMemoryAvailable.setText("- Available");
|
||||||
panel2.add(pysicalMemoryAvailable, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
panel2.add(physicalMemoryAvailable, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
final Spacer spacer1 = new Spacer();
|
final Spacer spacer1 = new Spacer();
|
||||||
panel2.add(spacer1, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
|
panel2.add(spacer1, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
|
||||||
final JPanel panel3 = new JPanel();
|
final JPanel panel3 = new JPanel();
|
||||||
panel3.setLayout(new GridLayoutManager(3, 3, new Insets(0, 0, 0, 0), -1, -1));
|
panel3.setLayout(new GridLayoutManager(3, 3, new Insets(10, 10, 10, 10), -1, -1));
|
||||||
panel1.add(panel3, new GridConstraints(1, 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));
|
panel1.add(panel3, new GridConstraints(1, 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));
|
||||||
virtualMemoryTitle = new JLabel();
|
virtualMemoryTitle = new JLabel();
|
||||||
virtualMemoryTitle.setText("Virtual Memory(Swap)");
|
virtualMemoryTitle.setText("Virtual Memory");
|
||||||
panel3.add(virtualMemoryTitle, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
panel3.add(virtualMemoryTitle, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
virtualMemoryProgressBar = new JProgressBar();
|
virtualMemoryProgressBar = new JProgressBar();
|
||||||
panel3.add(virtualMemoryProgressBar, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
panel3.add(virtualMemoryProgressBar, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
@ -114,8 +166,24 @@ public class MemoryForm {
|
||||||
panel3.add(virtualMemoryAvailable, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
panel3.add(virtualMemoryAvailable, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
final Spacer spacer2 = new Spacer();
|
final Spacer spacer2 = new Spacer();
|
||||||
panel3.add(spacer2, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
|
panel3.add(spacer2, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
|
||||||
|
final JPanel panel4 = new JPanel();
|
||||||
|
panel4.setLayout(new GridLayoutManager(3, 3, new Insets(10, 10, 10, 10), -1, -1));
|
||||||
|
panel1.add(panel4, new GridConstraints(2, 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));
|
||||||
|
swapTitle = new JLabel();
|
||||||
|
swapTitle.setText("Swap");
|
||||||
|
panel4.add(swapTitle, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
swapProgressBar = new JProgressBar();
|
||||||
|
panel4.add(swapProgressBar, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
swapUsedLabel = new JLabel();
|
||||||
|
swapUsedLabel.setText("Used -");
|
||||||
|
panel4.add(swapUsedLabel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
swapAvailableLabel = new JLabel();
|
||||||
|
swapAvailableLabel.setText("- Available");
|
||||||
|
panel4.add(swapAvailableLabel, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
final Spacer spacer3 = new Spacer();
|
final Spacer spacer3 = new Spacer();
|
||||||
panel1.add(spacer3, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
|
panel4.add(spacer3, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
|
||||||
|
final Spacer spacer4 = new Spacer();
|
||||||
|
panel1.add(spacer4, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue