package com.its.traf.ui; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import com.intellij.uiDesigner.core.Spacer; import com.its.app.utils.SysUtils; import com.its.traf.global.AppRepository; import com.its.traf.global.TrafJobVo; import com.sun.management.OperatingSystemMXBean; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import javax.swing.Timer; import javax.swing.*; import javax.swing.border.MatteBorder; import javax.swing.plaf.FontUIResource; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumnModel; import javax.swing.text.StyleContext; import java.awt.*; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.File; import java.io.IOException; import java.lang.management.ManagementFactory; import java.util.List; import java.util.*; @Slf4j @Getter public class MainUI { private static MainUI _instance = null; private SubUIController subUIController = null; private JFrame jFrame = null; private final OperatingSystemMXBean osBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); private Timer timer; private Long tick = Long.valueOf(0); private TrafJobVo selObj = null; private TrafPrcsTableModel trafPrcsTableModel = null; private TrafPrcsTableModel trafStatTableModel = null; private TableCellRenderer cellPrcsRender = new TrafPrcsTableCellRenderer(); private TableCellRenderer cellStatRender = new TrafPrcsTableCellRenderer(); private JPanel rootPanel; private JPanel pnlCtlr; private JPanel pnlLog; private JPanel pnlLogTitle; private JButton btnLogDirOpen; private JButton btnLogPause; private JCheckBox chkLogPause; private JLabel lblSystime; private JPanel pnlStatusBar; private JTextArea taLog; private JButton btnLogCopy; private JLabel lblCpuRate; private JLabel lblMemoryUsage; private JTabbedPane tabInfo; private JPanel tabPrcs; private JTable listPrcs; private JPanel tabStat; private JTable listStat; private boolean isUpdatable; public static MainUI getInstance() { return _instance; } public void displaySystime() { lblSystime.setText(" " + SysUtils.getSysTimeStr() + " "); } public void displayResource() { long memoryUsage = Math.round(((double) (this.osBean.getTotalPhysicalMemorySize() - this.osBean.getFreePhysicalMemorySize())) / (double) this.osBean.getTotalPhysicalMemorySize() * 100.0); lblMemoryUsage.setText(String.valueOf(memoryUsage)); double cpuLoad = this.osBean.getSystemCpuLoad(); // double cpuLoad = getCpuLoad(); // long t = System.currentTimeMillis(); // while ((System.currentTimeMillis() < t + 5000)) { // if (cpuLoad >= 0.0 && cpuLoad <= 1.0) { // break; // } // cpuLoad = osBean.getSystemCpuLoad(); // } if (cpuLoad >= 0.0 && cpuLoad <= 1.0) { lblCpuRate.setText(String.valueOf(Math.round(cpuLoad * 100.0))); } else { lblCpuRate.setText("---"); } // try { // MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); // ObjectName name = ObjectName.getInstance("java.lang:type=OperatingSystem"); // AttributeList list = mbs.getAttributes(name, new String[]{"ProcessCpuLoad"}); // // log.error("{}", mbs); // log.error("{}", name); // log.error("{}", list); // // } catch (Exception ex) { // } } // public double getCpuLoad() { // OperatingSystemMXBean operatingSystemMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); // double load; // try { // Method method = OperatingSystemMXBean.class.getMethod("getSystemLoadAverage", new Class[0]); // load = (Double) method.invoke(operatingSystemMXBean, new Object[0]); // if (load == -1) { // OperatingSystemMXBean bean = (OperatingSystemMXBean) operatingSystemMXBean; // load = bean.getSystemCpuLoad(); // } // } catch (Throwable e) { // load = -1; // } // return load; // } // // public float getCpuUsed() { // OperatingSystemMXBean osMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); // long previousJvmProcessCpuTime = osMXBean.getProcessCpuTime(); // int sleepTime = 350; // try { // TimeUnit.MILLISECONDS.sleep(sleepTime); // } catch (InterruptedException e) { // log.error("InterruptedException occurred while MemoryCollector sleeping..."); // } // long elapsedProcessCpuTime = osMXBean.getProcessCpuTime() - previousJvmProcessCpuTime; // long elapsedJvmUptime = sleepTime; // //long totalElapsedJvmUptime = elapsedJvmUptime * osMXBean.getAvailableProcessors() ; // long totalElapsedJvmUptime = elapsedJvmUptime; // //System.out.println("echo cpu processors num " + osMXBean.getAvailableProcessors()); // float cpuUsage = elapsedProcessCpuTime / (totalElapsedJvmUptime * 10000F); // return (float) (Math.round(cpuUsage * 10) / 10); // } public MainUI(JFrame jFrame) { System.setProperty("awt.useSystemAAFontSettings", "false"); // AntiAliasing false this.isUpdatable = false; this.jFrame = jFrame; if (_instance == null) { _instance = this; subUIController = new SubUIController(jFrame); subUIController.setVisible(false); } try { Font font = Font.createFont(Font.TRUETYPE_FONT, new File("fonts/D2Coding.ttc")); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ge.registerFont(font); } catch (FontFormatException e) { } catch (IOException e) { } Font d2font = new Font("D2Coding", Font.PLAIN, 14); if (d2font != null) { taLog.setFont(d2font); } displaySystime(); displayResource(); timer = new Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent evt) { displaySystime(); tick++; if (tick % 5 == 0) { displayResource(); } } }); timer.start(); chkLogPause.setFocusable(false); btnLogPause.setFocusable(false); btnLogDirOpen.setFocusable(false); btnLogCopy.setFocusable(false); btnLogPause.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { taLog.setText(null); } }); btnLogDirOpen.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Runtime rt = Runtime.getRuntime(); try { rt.exec("explorer.exe logs"); } catch (IOException ex) { throw new RuntimeException(ex); } } }); chkLogPause.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JTextAreaOutputStream.isLoggingPause = chkLogPause.isSelected(); } }); btnLogCopy.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { StringSelection stringSelection = new StringSelection(taLog.getText()); Clipboard clpBrd = Toolkit.getDefaultToolkit().getSystemClipboard(); clpBrd.setContents(stringSelection, null); } }); listPrcs.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent me) { if (me.getClickCount() == 2) { updateControllerInfo(listPrcs); } } }); listStat.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent me) { if (me.getClickCount() == 2) { updateControllerInfo(listStat); } } }); } private boolean updateControllerInfo(JTable listInfo) { if (subUIController.isVisible()) { subUIController.setVisible(false); } if (!this.isUpdatable) { return false; } int row = listInfo.getSelectedRow(); if (row < 0) { return false; } TrafPrcsTableModel tableModel = (TrafPrcsTableModel) listInfo.getModel(); selObj = tableModel.getControllerInfo(row); if (selObj != null) { subUIController.updateInfo(selObj); if (!subUIController.isVisible()) { subUIController.setVisible(true); } return true; } return true; } /** * 목록 헤더 생성 */ private void initTblListUI(List prcsList, List statList) { this.trafPrcsTableModel = new TrafPrcsTableModel(prcsList); this.trafStatTableModel = new TrafPrcsTableModel(statList); listPrcs.setModel(this.trafPrcsTableModel); listStat.setModel(this.trafStatTableModel); listPrcs.getTableHeader().setOpaque(false); listPrcs.getTableHeader().setBackground(Color.LIGHT_GRAY); listPrcs.setRowMargin(1); listPrcs.setRowHeight(listPrcs.getRowHeight() + 5); listPrcs.setBackground(Color.WHITE); listPrcs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); TableColumnModel getColumnModel = listPrcs.getColumnModel(); getColumnModel.getColumn(0).setPreferredWidth(30); // "S", getColumnModel.getColumn(1).setPreferredWidth(180); // "작업명", getColumnModel.getColumn(2).setPreferredWidth(230); // "타겟", getColumnModel.getColumn(3).setPreferredWidth(150); // "시작시각", getColumnModel.getColumn(4).setPreferredWidth(150); // "종료시각", getColumnModel.getColumn(5).setPreferredWidth(60); // "건수(EA)", getColumnModel.getColumn(6).setPreferredWidth(60); // "작업시간(ms)", getColumnModel.getColumn(7).setPreferredWidth(60); // "평균작업시간", getColumnModel.getColumn(0).setMaxWidth(30); getColumnModel.getColumn(0).setMinWidth(30); getColumnModel.getColumn(0).setResizable(false); Color color = UIManager.getColor("Table.gridColor"); MatteBorder border = new MatteBorder(1, 1, 0, 0, color); listPrcs.setBorder(border); for (int ii = 0; ii < getColumnModel.getColumnCount(); ii++) { getColumnModel.getColumn(ii).setCellRenderer(this.cellPrcsRender); } listStat.getTableHeader().setOpaque(false); listStat.getTableHeader().setBackground(Color.LIGHT_GRAY); listStat.setRowMargin(1); listStat.setRowHeight(listStat.getRowHeight() + 5); listStat.setBackground(Color.WHITE); listStat.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); TableColumnModel getColumnModel_ = listStat.getColumnModel(); getColumnModel_.getColumn(0).setPreferredWidth(30); // "S", getColumnModel_.getColumn(1).setPreferredWidth(140); // "작업명", getColumnModel_.getColumn(2).setPreferredWidth(220); // "타겟", getColumnModel_.getColumn(3).setPreferredWidth(140); // "시작시각", getColumnModel_.getColumn(4).setPreferredWidth(140); // "종료시각", getColumnModel_.getColumn(5).setPreferredWidth(70); // "건수(EA)", getColumnModel_.getColumn(6).setPreferredWidth(70); // "작업시간(ms)", getColumnModel_.getColumn(7).setPreferredWidth(70); // "평균작업시간", getColumnModel_.getColumn(0).setMaxWidth(30); getColumnModel_.getColumn(0).setMinWidth(30); getColumnModel_.getColumn(0).setResizable(false); listStat.setBorder(border); for (int ii = 0; ii < getColumnModel_.getColumnCount(); ii++) { getColumnModel_.getColumn(ii).setCellRenderer(this.cellStatRender); } this.isUpdatable = true; } public void LoadControllerInfo() { SortedMap prcsMap = new TreeMap<>(); for (Map.Entry e : AppRepository.getInstance().getPrcsMap().entrySet()) { TrafJobVo obj = e.getValue(); prcsMap.put(obj.getJobSeq(), obj); } SortedMap statMap = new TreeMap<>(); for (Map.Entry e : AppRepository.getInstance().getStatMap().entrySet()) { TrafJobVo obj = e.getValue(); statMap.put(obj.getJobSeq(), obj); } // List prcsList = new ArrayList(AppRepository.getInstance().getPrcsMap().values()); // List statList = new ArrayList(AppRepository.getInstance().getStatMap().values()); List prcsList = new ArrayList(prcsMap.values()); List statList = new ArrayList(statMap.values()); initTblListUI(prcsList, statList); } public void updateTrafPrcs() { if (!this.isUpdatable) { return; } try { TrafPrcsTableModel tableModel = (TrafPrcsTableModel) this.listPrcs.getModel(); if (tableModel != null) { tableModel.fireTableDataChanged(); } } catch (ClassCastException e) { log.error("Cast MainUI.updateTrafPrcs Error"); } } public void updateTrafStat() { if (!this.isUpdatable) { return; } try { TrafPrcsTableModel tableModel = (TrafPrcsTableModel) this.listStat.getModel(); if (tableModel != null) { tableModel.fireTableDataChanged(); } } catch (ClassCastException e) { log.error("Cast MainUI.updateTrafStat Error"); } } { // 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$$$() { rootPanel = new JPanel(); rootPanel.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1)); pnlCtlr = new JPanel(); pnlCtlr.setLayout(new GridLayoutManager(1, 1, new Insets(10, 4, 0, 4), -1, -1)); rootPanel.add(pnlCtlr, 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)); tabInfo = new JTabbedPane(); Font tabInfoFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, tabInfo.getFont()); if (tabInfoFont != null) tabInfo.setFont(tabInfoFont); pnlCtlr.add(tabInfo, 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)); tabPrcs = new JPanel(); tabPrcs.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); Font tabPrcsFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, tabPrcs.getFont()); if (tabPrcsFont != null) tabPrcs.setFont(tabPrcsFont); tabInfo.addTab(" 교통정보가공 ", tabPrcs); final JScrollPane scrollPane1 = new JScrollPane(); tabPrcs.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)); listPrcs = new JTable(); scrollPane1.setViewportView(listPrcs); tabStat = new JPanel(); tabStat.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); Font tabStatFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, tabStat.getFont()); if (tabStatFont != null) tabStat.setFont(tabStatFont); tabInfo.addTab(" 통계정보생성 ", tabStat); final JScrollPane scrollPane2 = new JScrollPane(); tabStat.add(scrollPane2, 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)); listStat = new JTable(); scrollPane2.setViewportView(listStat); pnlLog = new JPanel(); pnlLog.setLayout(new GridLayoutManager(2, 1, new Insets(0, 4, 0, 4), -1, -1)); rootPanel.add(pnlLog, 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, new Dimension(-1, 250), new Dimension(-1, 250), new Dimension(-1, 250), 0, false)); pnlLogTitle = new JPanel(); pnlLogTitle.setLayout(new GridLayoutManager(1, 6, new Insets(0, 0, 0, 2), 1, 1)); pnlLog.add(pnlLogTitle, 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(); Font label1Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label1.getFont()); if (label1Font != null) label1.setFont(label1Font); label1.setHorizontalAlignment(2); label1.setIcon(new ImageIcon(getClass().getResource("/static/image/logging.png"))); label1.setText("시스템 로그"); pnlLogTitle.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(); pnlLogTitle.add(spacer1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); btnLogDirOpen = new JButton(); Font btnLogDirOpenFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogDirOpen.getFont()); if (btnLogDirOpenFont != null) btnLogDirOpen.setFont(btnLogDirOpenFont); btnLogDirOpen.setHorizontalTextPosition(0); btnLogDirOpen.setText("로그 폴더"); pnlLogTitle.add(btnLogDirOpen, new GridConstraints(0, 5, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); btnLogPause = new JButton(); Font btnLogPauseFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogPause.getFont()); if (btnLogPauseFont != null) btnLogPause.setFont(btnLogPauseFont); btnLogPause.setHorizontalTextPosition(0); btnLogPause.setText("지우기"); pnlLogTitle.add(btnLogPause, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); chkLogPause = new JCheckBox(); Font chkLogPauseFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, chkLogPause.getFont()); if (chkLogPauseFont != null) chkLogPause.setFont(chkLogPauseFont); chkLogPause.setHorizontalAlignment(0); chkLogPause.setHorizontalTextPosition(11); chkLogPause.setText("멈춤"); pnlLogTitle.add(chkLogPause, 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)); btnLogCopy = new JButton(); Font btnLogCopyFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogCopy.getFont()); if (btnLogCopyFont != null) btnLogCopy.setFont(btnLogCopyFont); btnLogCopy.setText("복사"); pnlLogTitle.add(btnLogCopy, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JScrollPane scrollPane3 = new JScrollPane(); Font scrollPane3Font = this.$$$getFont$$$("D2Coding", Font.PLAIN, 12, scrollPane3.getFont()); if (scrollPane3Font != null) scrollPane3.setFont(scrollPane3Font); pnlLog.add(scrollPane3, 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)); taLog = new JTextArea(); taLog.setBackground(new Color(-16777216)); taLog.setCaretColor(new Color(-1)); taLog.setEditable(false); Font taLogFont = this.$$$getFont$$$("D2Coding", Font.PLAIN, 14, taLog.getFont()); if (taLogFont != null) taLog.setFont(taLogFont); taLog.setForeground(new Color(-1)); taLog.setMargin(new Insets(4, 4, 4, 4)); taLog.setText("[10:50:08.561] [ INFO] ************************************************************************************\n[10:50:08.561] [ INFO] ** Center Communication Server Information **\n[10:50:08.561] [ INFO] ** bindAddress: 0.0.0.0\n[10:50:08.561] [ INFO] ** listenPort: 9901\n[10:50:08.561] [ INFO] ** backlog: 1024\n[10:50:08.561] [ INFO] ** acceptThreads: 16\n[10:50:08.561] [ INFO] ** workerThreads: 16\n[10:50:08.561] [ INFO] ************************************************************************************\n"); scrollPane3.setViewportView(taLog); pnlStatusBar = new JPanel(); pnlStatusBar.setLayout(new GridLayoutManager(1, 7, new Insets(0, 4, 4, 4), -1, -1)); rootPanel.add(pnlStatusBar, 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)); final Spacer spacer2 = new Spacer(); pnlStatusBar.add(spacer2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); lblSystime = new JLabel(); Font lblSystimeFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblSystime.getFont()); if (lblSystimeFont != null) lblSystime.setFont(lblSystimeFont); lblSystime.setHorizontalAlignment(0); lblSystime.setHorizontalTextPosition(0); lblSystime.setText(" 2022-08-04 13:24:33 "); pnlStatusBar.add(lblSystime, new GridConstraints(0, 6, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label2 = new JLabel(); label2.setIcon(new ImageIcon(getClass().getResource("/static/image/on.png"))); label2.setText(" "); pnlStatusBar.add(label2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lblCpuRate = new JLabel(); Font lblCpuRateFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblCpuRate.getFont()); if (lblCpuRateFont != null) lblCpuRate.setFont(lblCpuRateFont); lblCpuRate.setHorizontalAlignment(2); lblCpuRate.setHorizontalTextPosition(0); lblCpuRate.setText(" "); pnlStatusBar.add(lblCpuRate, new GridConstraints(0, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(40, -1), new Dimension(40, -1), new Dimension(40, -1), 0, false)); lblMemoryUsage = new JLabel(); Font lblMemoryUsageFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 12, lblMemoryUsage.getFont()); if (lblMemoryUsageFont != null) lblMemoryUsage.setFont(lblMemoryUsageFont); lblMemoryUsage.setHorizontalAlignment(2); lblMemoryUsage.setHorizontalTextPosition(0); lblMemoryUsage.setText(" "); pnlStatusBar.add(lblMemoryUsage, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(40, -1), new Dimension(40, -1), new Dimension(40, -1), 0, false)); final JLabel label3 = new JLabel(); Font label3Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label3.getFont()); if (label3Font != null) label3.setFont(label3Font); label3.setHorizontalAlignment(0); label3.setHorizontalTextPosition(0); label3.setText(" CPU 사용율(%):"); pnlStatusBar.add(label3, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label4 = new JLabel(); Font label4Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label4.getFont()); if (label4Font != null) label4.setFont(label4Font); label4.setHorizontalAlignment(0); label4.setHorizontalTextPosition(0); label4.setText(" 메모리 사용율(%):"); pnlStatusBar.add(label4, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); } /** * @noinspection ALL */ private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) { if (currentFont == null) return null; String resultName; if (fontName == null) { resultName = currentFont.getName(); } else { Font testFont = new Font(fontName, Font.PLAIN, 10); if (testFont.canDisplay('a') && testFont.canDisplay('1')) { resultName = fontName; } else { resultName = currentFont.getName(); } } Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize()); boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac"); Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize()); return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback); } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return rootPanel; } }