add Icon Mac Windows

This commit is contained in:
Hansjörg Hofer 2024-01-13 19:33:21 +01:00
parent 9cf5076bab
commit 42a8c75cdf
2 changed files with 300 additions and 206 deletions

20
pom.xml
View File

@ -127,7 +127,25 @@
<artifactId>jfreechart</artifactId> <artifactId>jfreechart</artifactId>
<version>${jfreechart.version}</version> <version>${jfreechart.version}</version>
</dependency> </dependency>
</dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-imaging</artifactId>
<version>1.0-alpha3</version>
</dependency>
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-icns</artifactId>
<version>3.10.1</version>
</dependency>
<dependency>
<groupId>ru.oleg-cherednik.icoman</groupId>
<artifactId>icon-manager</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build> <build>
<plugins> <plugins>

View File

@ -8,15 +8,29 @@ 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 com.luoboduner.moo.info.ui.UiConsts;
import lombok.Getter; import lombok.Getter;
import org.apache.commons.imaging.ImageReadException;
import org.apache.commons.imaging.formats.icns.IcnsImageParser;
import org.apache.commons.lang3.SystemUtils;
import oshi.PlatformEnum; import oshi.PlatformEnum;
import oshi.SystemInfo; import oshi.SystemInfo;
import oshi.software.os.OSProcess; import oshi.software.os.OSProcess;
import oshi.software.os.OperatingSystem; import oshi.software.os.OperatingSystem;
import oshi.util.FormatUtil; import oshi.util.FormatUtil;
import ru.olegcherednik.icoman.IconFile;
import ru.olegcherednik.icoman.IconManager;
import ru.olegcherednik.icoman.exceptions.IconManagerException;
import ru.olegcherednik.icoman.exceptions.IconNotFoundException;
import sun.awt.shell.ShellFolder;
import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
import javax.swing.filechooser.FileSystemView;
import javax.swing.table.*; import javax.swing.table.*;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -30,176 +44,238 @@ import java.util.Map;
*/ */
@Getter @Getter
public class ProcessesForm { public class ProcessesForm {
private static final String[] COLUMNS = {"PID", "PPID", "Threads", "% CPU", "Cumulative", "VSZ", "RSS", "% Memory", private static final String[] COLUMNS = {"ICON", "PID", "PPID", "Threads", "% CPU", "Cumulative", "VSZ", "RSS", "% Memory",
"Process Name"}; "Process Name"};
private static final double[] COLUMN_WIDTH_PERCENT = {0.07, 0.07, 0.07, 0.07, 0.09, 0.1, 0.1, 0.08, 0.35}; private static final double[] COLUMN_WIDTH_PERCENT = {0.001, 0.07, 0.07, 0.07, 0.07, 0.09, 0.1, 0.1, 0.08, 0.35};
private transient static Map<Integer, OSProcess> priorSnapshotMap = new HashMap<>(); private transient static Map<Integer, OSProcess> priorSnapshotMap = new HashMap<>();
private static final Log logger = LogFactory.get(); private static final Log logger = LogFactory.get();
private static ProcessesForm processesForm; private static ProcessesForm processesForm;
private JPanel mainPanel; private JPanel mainPanel;
private JTable processTable; private JTable processTable;
private JRadioButton cpuButton; private JRadioButton cpuButton;
private JRadioButton cumulativeCpuButton; private JRadioButton cumulativeCpuButton;
private JRadioButton memButton; private JRadioButton memButton;
private JRadioButton perProc; private JRadioButton perProc;
private JRadioButton perSystem; private JRadioButton perSystem;
public static ProcessesForm getInstance() { public static ProcessesForm getInstance() {
if (processesForm == null) { if (processesForm == null) {
processesForm = new ProcessesForm(); processesForm = new ProcessesForm();
} }
return processesForm; return processesForm;
} }
public static void init() { public static void init() {
processesForm = getInstance(); processesForm = getInstance();
initUi(); initUi();
initInfo(); initInfo();
} }
private static void initUi() { private static void initUi() {
resetCpuPercentButtonGroup(); resetCpuPercentButtonGroup();
resetSortByButtonGroup(); resetSortByButtonGroup();
processesForm = getInstance(); processesForm = getInstance();
if (SystemInfo.getCurrentPlatform().equals(PlatformEnum.WINDOWS)) { if (SystemInfo.getCurrentPlatform().equals(PlatformEnum.WINDOWS)) {
processesForm.perSystem.setSelected(true); processesForm.perSystem.setSelected(true);
} else { } else {
processesForm.perProc.setSelected(true); processesForm.perProc.setSelected(true);
} }
processesForm.cpuButton.setSelected(true); processesForm.cpuButton.setSelected(true);
processesForm.perProc.addActionListener(e -> { processesForm.perProc.addActionListener(e -> {
resetCpuPercentButtonGroup(); resetCpuPercentButtonGroup();
processesForm.perProc.setSelected(true); processesForm.perProc.setSelected(true);
}); });
processesForm.perSystem.addActionListener(e -> { processesForm.perSystem.addActionListener(e -> {
resetCpuPercentButtonGroup(); resetCpuPercentButtonGroup();
processesForm.perSystem.setSelected(true); processesForm.perSystem.setSelected(true);
}); });
processesForm.cpuButton.addActionListener(e -> { processesForm.cpuButton.addActionListener(e -> {
resetSortByButtonGroup(); resetSortByButtonGroup();
processesForm.cpuButton.setSelected(true); processesForm.cpuButton.setSelected(true);
}); });
processesForm.cumulativeCpuButton.addActionListener(e -> { processesForm.cumulativeCpuButton.addActionListener(e -> {
resetSortByButtonGroup(); resetSortByButtonGroup();
processesForm.cumulativeCpuButton.setSelected(true); processesForm.cumulativeCpuButton.setSelected(true);
}); });
processesForm.memButton.addActionListener(e -> { processesForm.memButton.addActionListener(e -> {
resetSortByButtonGroup(); resetSortByButtonGroup();
processesForm.memButton.setSelected(true); processesForm.memButton.setSelected(true);
}); });
} }
/** /**
* Codes are copied from oshi and have some modifications. * Codes are copied from oshi and have some modifications.
*/ */
private static void initInfo() { private static void initInfo() {
OperatingSystem os = App.si.getOperatingSystem(); OperatingSystem os = App.si.getOperatingSystem();
TableModel model = new DefaultTableModel(parseProcesses(os.getProcesses(null, null, 0), App.si), COLUMNS); TableModel model = new DefaultTableModel(parseProcesses(os.getProcesses(null, null, 0), App.si), COLUMNS) {
JTable procTable = getInstance().getProcessTable(); @Override
procTable.setModel(model); public Class<?> getColumnClass(int column) {
resizeColumns(procTable.getColumnModel()); if (column == 0) return ImageIcon.class;
procTable.setShowGrid(true); return Object.class;
}
};
JTable procTable = getInstance().getProcessTable();
procTable.setModel(model);
resizeColumns(procTable.getColumnModel());
procTable.setShowGrid(true);
DefaultTableCellRenderer hr = (DefaultTableCellRenderer) procTable.getTableHeader() DefaultTableCellRenderer hr = (DefaultTableCellRenderer) procTable.getTableHeader()
.getDefaultRenderer(); .getDefaultRenderer();
// The name of header column turn to left // The name of header column turn to left
hr.setHorizontalAlignment(DefaultTableCellRenderer.LEFT); hr.setHorizontalAlignment(DefaultTableCellRenderer.LEFT);
Timer timer = new Timer(UiConsts.REFRESH_SLOW, e -> { Timer timer = new Timer(UiConsts.REFRESH_SLOW, e -> {
DefaultTableModel tableModel = (DefaultTableModel) procTable.getModel(); DefaultTableModel tableModel = (DefaultTableModel) procTable.getModel();
Object[][] newData = parseProcesses(os.getProcesses(null, null, 0), App.si); Object[][] newData = parseProcesses(os.getProcesses(null, null, 0), App.si);
int rowCount = tableModel.getRowCount(); int rowCount = tableModel.getRowCount();
for (int row = 0; row < newData.length; row++) { for (int row = 0; row < newData.length; row++) {
if (row < rowCount) { if (row < rowCount) {
// Overwrite row // Overwrite row
for (int col = 0; col < newData[row].length; col++) { for (int col = 0; col < newData[row].length; col++) {
tableModel.setValueAt(newData[row][col], row, col); tableModel.setValueAt(newData[row][col], row, col);
} }
} else { } else {
// Add row // Add row
tableModel.addRow(newData[row]); tableModel.addRow(newData[row]);
} }
} }
// Delete any extra rows // Delete any extra rows
for (int row = rowCount - 1; row >= newData.length; row--) { for (int row = rowCount - 1; row >= newData.length; row--) {
tableModel.removeRow(row); tableModel.removeRow(row);
} }
}); });
timer.start(); timer.start();
} }
/** /**
* Codes are copied from oshi and have some modifications. * Codes are copied from oshi and have some modifications.
* *
* @param list * @param list
* @param si * @param si
* @return * @return
*/ */
private static Object[][] parseProcesses(List<OSProcess> list, SystemInfo si) { private static Object[][] parseProcesses(List<OSProcess> list, SystemInfo si) {
processesForm = getInstance(); processesForm = getInstance();
long totalMem = si.getHardware().getMemory().getTotal(); long totalMem = si.getHardware().getMemory().getTotal();
int cpuCount = si.getHardware().getProcessor().getLogicalProcessorCount(); int cpuCount = si.getHardware().getProcessor().getLogicalProcessorCount();
// Build a map with a value for each process to control the sort // Build a map with a value for each process to control the sort
Map<OSProcess, Double> processSortValueMap = new HashMap<>(); Map<OSProcess, Double> processSortValueMap = new HashMap<>();
for (OSProcess p : list) { for (OSProcess p : list) {
int pid = p.getProcessID(); int pid = p.getProcessID();
// Ignore the Idle process on Windows // Ignore the Idle process on Windows
if (pid > 0 || !SystemInfo.getCurrentPlatform().equals(PlatformEnum.WINDOWS)) { if (pid > 0 || !SystemInfo.getCurrentPlatform().equals(PlatformEnum.WINDOWS)) {
// Set up for appropriate sort // Set up for appropriate sort
if (processesForm.cpuButton.isSelected()) { if (processesForm.cpuButton.isSelected()) {
processSortValueMap.put(p, p.getProcessCpuLoadBetweenTicks(priorSnapshotMap.get(pid))); processSortValueMap.put(p, p.getProcessCpuLoadBetweenTicks(priorSnapshotMap.get(pid)));
} else if (processesForm.cumulativeCpuButton.isSelected()) { } else if (processesForm.cumulativeCpuButton.isSelected()) {
processSortValueMap.put(p, p.getProcessCpuLoadCumulative()); processSortValueMap.put(p, p.getProcessCpuLoadCumulative());
} else { } else {
processSortValueMap.put(p, (double) p.getResidentSetSize()); processSortValueMap.put(p, (double) p.getResidentSetSize());
} }
} }
} }
// Now sort the list by the values // Now sort the list by the values
List<Map.Entry<OSProcess, Double>> procList = new ArrayList<>(processSortValueMap.entrySet()); List<Map.Entry<OSProcess, Double>> procList = new ArrayList<>(processSortValueMap.entrySet());
procList.sort(Map.Entry.comparingByValue()); procList.sort(Map.Entry.comparingByValue());
// Insert into array in reverse order (lowest sort value last) // Insert into array in reverse order (lowest sort value last)
int i = procList.size(); int i = procList.size();
Object[][] procArr = new Object[i][COLUMNS.length]; Object[][] procArr = new Object[i][COLUMNS.length];
// These are in descending CPU order // These are in descending CPU order
for (Map.Entry<OSProcess, Double> e : procList) { for (Map.Entry<OSProcess, Double> e : procList) {
OSProcess p = e.getKey(); OSProcess p = e.getKey();
// Matches order of COLUMNS field // Matches order of COLUMNS field
i--; i--;
int pid = p.getProcessID(); int pid = p.getProcessID();
procArr[i][0] = pid; procArr[i][0] = getProcessIcon(p.getCommandLine());
procArr[i][1] = p.getParentProcessID(); procArr[i][1] = pid;
procArr[i][2] = p.getThreadCount(); procArr[i][2] = p.getParentProcessID();
if (processesForm.perProc.isSelected()) { procArr[i][3] = p.getThreadCount();
procArr[i][3] = String.format("%.1f", if (processesForm.perProc.isSelected()) {
100d * p.getProcessCpuLoadBetweenTicks(priorSnapshotMap.get(pid)) / cpuCount); procArr[i][4] = String.format("%.1f",
procArr[i][4] = String.format("%.1f", 100d * p.getProcessCpuLoadCumulative() / cpuCount); 100d * p.getProcessCpuLoadBetweenTicks(priorSnapshotMap.get(pid)) / cpuCount);
} else { procArr[i][5] = String.format("%.1f", 100d * p.getProcessCpuLoadCumulative() / cpuCount);
procArr[i][3] = String.format("%.1f", } else {
100d * p.getProcessCpuLoadBetweenTicks(priorSnapshotMap.get(pid))); procArr[i][4] = String.format("%.1f",
procArr[i][4] = String.format("%.1f", 100d * p.getProcessCpuLoadCumulative()); 100d * p.getProcessCpuLoadBetweenTicks(priorSnapshotMap.get(pid)));
} procArr[i][5] = String.format("%.1f", 100d * p.getProcessCpuLoadCumulative());
procArr[i][5] = FormatUtil.formatBytes(p.getVirtualSize()); }
procArr[i][6] = FormatUtil.formatBytes(p.getResidentSetSize()); procArr[i][6] = FormatUtil.formatBytes(p.getVirtualSize());
procArr[i][7] = String.format("%.1f", 100d * p.getResidentSetSize() / totalMem); procArr[i][7] = FormatUtil.formatBytes(p.getResidentSetSize());
procArr[i][8] = p.getName(); procArr[i][8] = String.format("%.1f", 100d * p.getResidentSetSize() / totalMem);
} procArr[i][9] = p.getName();
// Re-populate snapshot map }
priorSnapshotMap.clear(); // Re-populate snapshot map
for (OSProcess p : list) { priorSnapshotMap.clear();
priorSnapshotMap.put(p.getProcessID(), p); for (OSProcess p : list) {
} priorSnapshotMap.put(p.getProcessID(), p);
return procArr; }
} return procArr;
}
/** private static Icon getProcessIcon(String fullProcessPathName) {
if (SystemUtils.IS_OS_WINDOWS) {
File file = new File(fullProcessPathName);
// Get metadata and create an icon
Icon icon = FileSystemView.getFileSystemView()
.getSystemIcon(file);
// ShellFolder sf =
// ShellFolder.getShellFolder(file);
// Icon icon = new ImageIcon(sf.getIcon(true));
return icon;
}
if (SystemUtils.IS_OS_MAC) {
if (fullProcessPathName.contains("MacOS")) {
String iconPath[] = fullProcessPathName.split("MacOS");
if (iconPath.length > 0) {
//"AppIcon.icns"
String iconFilePath = iconPath[0] + "Resources/AppIcon.icns";
File file = new File(iconFilePath);
//Imaging.getAllBufferedImages(iconFilePath);
try {
if (file.exists()) {
List<BufferedImage> is = new IcnsImageParser().getAllBufferedImages(new File(iconFilePath));
BufferedImage bufferedImage = is.get(0);
BufferedImage bufferedImageR = resizeImage(bufferedImage, 28, 28);
Icon icon = new ImageIcon(bufferedImageR);
return icon;
}
} catch (ImageReadException | IOException e) {
throw new RuntimeException(e);
}
//return new ImageIcon(Toolkit.getDefaultToolkit().getImage(iconFilePath));
}
}
}
return null;
}
/**
* ResizeImage BufferedImage to given targetWidth targetHeight preserve transparency
*
* @param originalImage
* @param targetWidth
* @param targetHeight
* @return resizeImage
*/
public static BufferedImage resizeImage(BufferedImage originalImage, int targetWidth, int targetHeight) throws IOException {
BufferedImage resizedImage = new BufferedImage(targetWidth, targetHeight, BufferedImage.TYPE_INT_ARGB_PRE);
Graphics2D graphics2D = resizedImage.createGraphics();
graphics2D.drawImage(originalImage, 0, 0, targetWidth, targetHeight, null);
graphics2D.dispose();
return resizedImage;
}
/**
* Codes are copied from oshi and have some modifications. * Codes are copied from oshi and have some modifications.
* *
* @param tableColumnModel * @param tableColumnModel
@ -230,60 +306,60 @@ public class ProcessesForm {
processesForm.perSystem.setSelected(false); processesForm.perSystem.setSelected(false);
} }
{ {
// GUI initializer generated by IntelliJ IDEA GUI Designer // GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<< // >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE! // DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$(); $$$setupUI$$$();
} }
/** /**
* Method generated by IntelliJ IDEA GUI Designer * Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<< * >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code! * DO NOT edit this method OR call it in your code!
* *
* @noinspection ALL * @noinspection ALL
*/ */
private void $$$setupUI$$$() { private void $$$setupUI$$$() {
mainPanel = new JPanel(); mainPanel = new JPanel();
mainPanel.setLayout(new GridLayoutManager(2, 1, new Insets(20, 20, 20, 20), -1, -1)); mainPanel.setLayout(new GridLayoutManager(2, 1, new Insets(20, 20, 20, 20), -1, -1));
final JScrollPane scrollPane1 = new JScrollPane(); final JScrollPane scrollPane1 = new JScrollPane();
mainPanel.add(scrollPane1, new GridConstraints(1, 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(1, 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));
processTable = new JTable(); processTable = new JTable();
scrollPane1.setViewportView(processTable); scrollPane1.setViewportView(processTable);
final JPanel panel1 = new JPanel(); final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(1, 8, new Insets(0, 0, 10, 0), -1, -1)); panel1.setLayout(new GridLayoutManager(1, 8, new Insets(0, 0, 10, 0), -1, -1));
mainPanel.add(panel1, 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)); mainPanel.add(panel1, 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));
final JLabel label1 = new JLabel(); final JLabel label1 = new JLabel();
label1.setText("Sort by: "); label1.setText("Sort by: ");
panel1.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); panel1.add(label1, new GridConstraints(0, 0, 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();
panel1.add(spacer1, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); panel1.add(spacer1, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final JLabel label2 = new JLabel(); final JLabel label2 = new JLabel();
label2.setText("CPU %: "); label2.setText("CPU %: ");
panel1.add(label2, new GridConstraints(0, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); panel1.add(label2, new GridConstraints(0, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
cpuButton = new JRadioButton(); cpuButton = new JRadioButton();
cpuButton.setText("CPU %"); cpuButton.setText("CPU %");
panel1.add(cpuButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); panel1.add(cpuButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
cumulativeCpuButton = new JRadioButton(); cumulativeCpuButton = new JRadioButton();
cumulativeCpuButton.setText("Cumulative CPU"); cumulativeCpuButton.setText("Cumulative CPU");
panel1.add(cumulativeCpuButton, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); panel1.add(cumulativeCpuButton, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
memButton = new JRadioButton(); memButton = new JRadioButton();
memButton.setText("Memory %"); memButton.setText("Memory %");
panel1.add(memButton, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); panel1.add(memButton, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
perProc = new JRadioButton(); perProc = new JRadioButton();
perProc.setText("of one Processor"); perProc.setText("of one Processor");
panel1.add(perProc, new GridConstraints(0, 6, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); panel1.add(perProc, new GridConstraints(0, 6, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
perSystem = new JRadioButton(); perSystem = new JRadioButton();
perSystem.setText("of System"); perSystem.setText("of System");
panel1.add(perSystem, new GridConstraints(0, 7, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); panel1.add(perSystem, new GridConstraints(0, 7, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
} }
/** /**
* @noinspection ALL * @noinspection ALL
*/ */
public JComponent $$$getRootComponent$$$() { public JComponent $$$getRootComponent$$$() {
return mainPanel; return mainPanel;
} }
} }