cpu form first step

This commit is contained in:
RememBerBer 2021-11-17 22:46:27 +08:00
parent ab5f180735
commit 55f61c0e61
3 changed files with 32 additions and 2 deletions

View File

@ -0,0 +1,25 @@
package com.luoboduner.moo.info.ui;
import com.luoboduner.moo.info.ui.form.MainWindow;
import javax.swing.*;
import java.awt.*;
/**
* customize Swing component style
*
* @author <a href="https://github.com/rememberber">RememBerBer</a>
* @since 2021/11/17.
*/
public class Style {
/**
* emphatic font for title
*
* @param component
*/
public static void emphaticFont(JComponent component) {
Font font = MainWindow.getInstance().getMainPanel().getFont();
component.setFont(new Font(font.getName(), Font.BOLD, font.getSize() + 2));
}
}

View File

@ -20,7 +20,7 @@
<border type="none"/>
<children>
<grid id="50678" 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="0"/>
<constraints>
<splitpane position="left"/>
</constraints>

View File

@ -8,6 +8,7 @@ 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.ui.UiConsts;
import lombok.Getter;
import oshi.hardware.CentralProcessor;
@ -56,6 +57,10 @@ public class CpuForm {
private static void initUi() {
CpuForm cpuForm = getInstance();
Style.emphaticFont(cpuForm.getScuTitleLabel());
Style.emphaticFont(cpuForm.getPcuTitleLabel());
Dimension d = new Dimension(-1, 100);
cpuForm.getScuProgressBar().setMinimumSize(d);
@ -113,7 +118,7 @@ public class CpuForm {
splitPane1.setDividerLocation(300);
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();
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 0), -1, -1));
splitPane1.setLeftComponent(panel1);
final JScrollPane scrollPane1 = new JScrollPane();
panel1.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));