cpu form first step
This commit is contained in:
parent
55f61c0e61
commit
4bb6ee41da
|
@ -15,7 +15,9 @@
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
|
<continuousLayout value="true"/>
|
||||||
<dividerLocation value="300"/>
|
<dividerLocation value="300"/>
|
||||||
|
<dividerSize value="14"/>
|
||||||
</properties>
|
</properties>
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
<children>
|
<children>
|
||||||
|
@ -102,14 +104,38 @@
|
||||||
</scrollpane>
|
</scrollpane>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
<grid id="b95f4" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="b95f4" layout-manager="GridLayoutManager" row-count="2" 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="0" bottom="10" right="10"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<splitpane position="right"/>
|
<splitpane position="right"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties/>
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
<children/>
|
<children>
|
||||||
|
<grid id="f729b" 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>
|
||||||
|
<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>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<component id="e6b25" class="javax.swing.JTextPane" binding="cpuInfoTextPane">
|
||||||
|
<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"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<editable value="false"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<vspacer id="303d7">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" 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>
|
||||||
|
</vspacer>
|
||||||
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
</children>
|
</children>
|
||||||
</splitpane>
|
</splitpane>
|
||||||
|
|
|
@ -33,6 +33,7 @@ public class CpuForm {
|
||||||
private JPanel pcuProgressBarPanel;
|
private JPanel pcuProgressBarPanel;
|
||||||
private JLabel scuTitleLabel;
|
private JLabel scuTitleLabel;
|
||||||
private JLabel pcuTitleLabel;
|
private JLabel pcuTitleLabel;
|
||||||
|
private JTextPane cpuInfoTextPane;
|
||||||
|
|
||||||
private static final Log logger = LogFactory.get();
|
private static final Log logger = LogFactory.get();
|
||||||
|
|
||||||
|
@ -49,6 +50,8 @@ public class CpuForm {
|
||||||
cpuForm = getInstance();
|
cpuForm = getInstance();
|
||||||
|
|
||||||
initUi();
|
initUi();
|
||||||
|
initCpuInfo();
|
||||||
|
|
||||||
Timer timer = new Timer(UiConsts.REFRESH_FAST, e -> {
|
Timer timer = new Timer(UiConsts.REFRESH_FAST, e -> {
|
||||||
initInfo();
|
initInfo();
|
||||||
});
|
});
|
||||||
|
@ -80,6 +83,15 @@ public class CpuForm {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void initCpuInfo() {
|
||||||
|
CpuForm cpuForm = getInstance();
|
||||||
|
JTextPane cpuInfoTextPane = cpuForm.getCpuInfoTextPane();
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(App.si.getHardware().getProcessor());
|
||||||
|
cpuInfoTextPane.setText(sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
private static void initInfo() {
|
private static void initInfo() {
|
||||||
CpuInfo cpuInfo = OshiUtil.getCpuInfo();
|
CpuInfo cpuInfo = OshiUtil.getCpuInfo();
|
||||||
DecimalFormat format = new DecimalFormat("#.00");
|
DecimalFormat format = new DecimalFormat("#.00");
|
||||||
|
@ -115,7 +127,9 @@ public class CpuForm {
|
||||||
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(0, 0, 0, 0), -1, -1));
|
||||||
final JSplitPane splitPane1 = new JSplitPane();
|
final JSplitPane splitPane1 = new JSplitPane();
|
||||||
|
splitPane1.setContinuousLayout(true);
|
||||||
splitPane1.setDividerLocation(300);
|
splitPane1.setDividerLocation(300);
|
||||||
|
splitPane1.setDividerSize(14);
|
||||||
mainPanel.add(splitPane1, 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, new Dimension(200, 200), null, 0, false));
|
mainPanel.add(splitPane1, 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, new Dimension(200, 200), null, 0, false));
|
||||||
final JPanel panel1 = new JPanel();
|
final JPanel panel1 = new JPanel();
|
||||||
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 0), -1, -1));
|
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 0), -1, -1));
|
||||||
|
@ -146,8 +160,16 @@ public class CpuForm {
|
||||||
final Spacer spacer1 = new Spacer();
|
final Spacer spacer1 = new Spacer();
|
||||||
panel2.add(spacer1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
|
panel2.add(spacer1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
|
||||||
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(2, 1, new Insets(10, 0, 10, 10), -1, -1));
|
||||||
splitPane1.setRightComponent(panel3);
|
splitPane1.setRightComponent(panel3);
|
||||||
|
final JPanel panel4 = new JPanel();
|
||||||
|
panel4.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1));
|
||||||
|
panel3.add(panel4, 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));
|
||||||
|
cpuInfoTextPane = new JTextPane();
|
||||||
|
cpuInfoTextPane.setEditable(false);
|
||||||
|
panel4.add(cpuInfoTextPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
|
||||||
|
final Spacer spacer2 = new Spacer();
|
||||||
|
panel3.add(spacer2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue