SubUI.java 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. package com.its.vds.ui;
  2. import com.intellij.uiDesigner.core.GridConstraints;
  3. import com.intellij.uiDesigner.core.GridLayoutManager;
  4. import com.intellij.uiDesigner.core.Spacer;
  5. import com.its.vds.domain.NET;
  6. import com.its.vds.entity.TbVdsCtlr;
  7. import com.its.vds.service.VdsCtlrService;
  8. import com.sun.management.OperatingSystemMXBean;
  9. import lombok.Getter;
  10. import lombok.extern.slf4j.Slf4j;
  11. import javax.swing.*;
  12. import javax.swing.plaf.FontUIResource;
  13. import javax.swing.text.StyleContext;
  14. import java.awt.*;
  15. import java.awt.datatransfer.Clipboard;
  16. import java.awt.datatransfer.StringSelection;
  17. import java.awt.event.ActionEvent;
  18. import java.awt.event.ActionListener;
  19. import java.io.File;
  20. import java.io.IOException;
  21. import java.lang.management.ManagementFactory;
  22. import java.util.Locale;
  23. @Slf4j
  24. @Getter
  25. public abstract class SubUI {
  26. private VdsCtlrService vdsCtlrService = null;
  27. OperatingSystemMXBean osBean = null;
  28. private TbVdsCtlr selObj = null;
  29. private JPanel rootPanel;
  30. private JPanel pnlCtlr;
  31. private JPanel pnlLog;
  32. private JPanel pnlLogTitle;
  33. private JPanel pnlCtlrTitlex;
  34. private JButton btnLogDirOpen;
  35. private JButton btnLogPause;
  36. private JCheckBox chkLogPause;
  37. private JTextArea taLog;
  38. private JButton btnLogCopy;
  39. private JPanel pnlControl;
  40. private JButton btnImage;
  41. private JButton btnInitialize;
  42. private JButton btnReset;
  43. private JButton btnDisconnect;
  44. private JTextField txtName;
  45. private JTextField txtId;
  46. private JTextField textField1;
  47. private JTextField textField2;
  48. protected abstract void actionButtonClicked();
  49. public SubUI() {
  50. System.setProperty("awt.useSystemAAFontSettings", "false"); // AntiAliasing false
  51. osBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class);
  52. try {
  53. Font font = Font.createFont(Font.TRUETYPE_FONT, new File("fonts/D2Coding.ttc"));
  54. GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  55. ge.registerFont(font);
  56. } catch (FontFormatException e) {
  57. } catch (IOException e) {
  58. }
  59. //taLog.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 14));
  60. Font d2font = new Font("D2Coding", Font.PLAIN, 14);
  61. if (d2font != null) {
  62. taLog.setFont(d2font);
  63. }
  64. taLog.setText(null);
  65. chkLogPause.setFocusable(false);
  66. btnLogPause.setFocusable(false);
  67. btnLogDirOpen.setFocusable(false);
  68. btnLogCopy.setFocusable(false);
  69. btnLogPause.addActionListener(new ActionListener() {
  70. @Override
  71. public void actionPerformed(ActionEvent e) {
  72. taLog.setText(null);
  73. }
  74. });
  75. btnLogDirOpen.addActionListener(new ActionListener() {
  76. @Override
  77. public void actionPerformed(ActionEvent e) {
  78. Runtime rt = Runtime.getRuntime();
  79. try {
  80. rt.exec("explorer.exe logs");
  81. } catch (IOException ex) {
  82. throw new RuntimeException(ex);
  83. }
  84. }
  85. });
  86. chkLogPause.addActionListener(new ActionListener() {
  87. @Override
  88. public void actionPerformed(ActionEvent e) {
  89. JTextAreaOutputStream.isLoggingPause = chkLogPause.isSelected();
  90. }
  91. });
  92. btnLogCopy.addActionListener(new ActionListener() {
  93. @Override
  94. public void actionPerformed(ActionEvent e) {
  95. StringSelection stringSelection = new StringSelection(taLog.getText());
  96. Clipboard clpBrd = Toolkit.getDefaultToolkit().getSystemClipboard();
  97. clpBrd.setContents(stringSelection, null);
  98. }
  99. });
  100. btnDisconnect.addActionListener(new ActionListener() {
  101. @Override
  102. public void actionPerformed(ActionEvent e) {
  103. controlController(1);
  104. }
  105. });
  106. btnReset.addActionListener(new ActionListener() {
  107. @Override
  108. public void actionPerformed(ActionEvent e) {
  109. controlController(2);
  110. }
  111. });
  112. btnInitialize.addActionListener(new ActionListener() {
  113. @Override
  114. public void actionPerformed(ActionEvent e) {
  115. controlController(3);
  116. }
  117. });
  118. btnImage.addActionListener(new ActionListener() {
  119. @Override
  120. public void actionPerformed(ActionEvent e) {
  121. controlController(4);
  122. }
  123. });
  124. }
  125. public void updateInfo(TbVdsCtlr selObj) {
  126. this.selObj = selObj;
  127. txtId.setText("");
  128. txtName.setText("");
  129. if (selObj != null) {
  130. txtId.setText(selObj.getVDS_CTLR_ID());
  131. txtName.setText(selObj.getVDS_NM());
  132. }
  133. }
  134. /**
  135. * 제어기 명령 처리
  136. *
  137. * @param type
  138. */
  139. public void controlController(int type) {
  140. if (selObj == null) {
  141. JOptionPane.showMessageDialog(getRootPanel(), "제어기가 선택되지 않았습니다. 목록을 더블클릭하여 제어기를 선택하세요.", "제어기 선택", JOptionPane.ERROR_MESSAGE);
  142. return;
  143. }
  144. if (selObj.getNetState() == NET.CLOSED) {
  145. JOptionPane.showMessageDialog(getRootPanel(), "제어기가 현재 연결이 되어 있지 않습니다.", "제어기 연결 상태", JOptionPane.ERROR_MESSAGE);
  146. return;
  147. }
  148. String message, title;
  149. switch (type) {
  150. case 1:
  151. message = "제어기와의 연결을 종료 하시겠습니까?";
  152. title = "제어기 연결 종료";
  153. break;
  154. case 2:
  155. message = "제어기를 리셋 하시겠습니까?";
  156. title = "제어기 리셋";
  157. break;
  158. case 3:
  159. message = "제어기를 초기화 하시겠습니까?";
  160. title = "제어기 초기화";
  161. break;
  162. case 4:
  163. message = "제어기의 정지영상 정보를 요청하시겠습니까?";
  164. title = "제어기 정지영상 요청";
  165. break;
  166. default:
  167. return;
  168. }
  169. if (JOptionPane.showConfirmDialog(getRootPanel(), message, title, JOptionPane.YES_NO_OPTION) != 0) {
  170. return;
  171. }
  172. boolean result = false;
  173. switch (type) {
  174. case 1:
  175. result = selObj.channelClose();
  176. break;
  177. case 2:
  178. result = selObj.reset();
  179. break;
  180. case 3:
  181. result = selObj.initialize();
  182. break;
  183. case 4:
  184. result = selObj.stopImage((byte) 0x01);
  185. break;
  186. default:
  187. return;
  188. }
  189. if (!result) {
  190. JOptionPane.showMessageDialog(getRootPanel(), "명령 전송이 실패 하였습니다.", title, JOptionPane.ERROR_MESSAGE);
  191. }
  192. }
  193. {
  194. // GUI initializer generated by IntelliJ IDEA GUI Designer
  195. // >>> IMPORTANT!! <<<
  196. // DO NOT EDIT OR ADD ANY CODE HERE!
  197. $$$setupUI$$$();
  198. }
  199. /**
  200. * Method generated by IntelliJ IDEA GUI Designer
  201. * >>> IMPORTANT!! <<<
  202. * DO NOT edit this method OR call it in your code!
  203. *
  204. * @noinspection ALL
  205. */
  206. private void $$$setupUI$$$() {
  207. rootPanel = new JPanel();
  208. rootPanel.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
  209. pnlCtlr = new JPanel();
  210. pnlCtlr.setLayout(new GridLayoutManager(2, 2, new Insets(10, 4, 0, 4), -1, -1));
  211. rootPanel.add(pnlCtlr, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  212. pnlCtlrTitlex = new JPanel();
  213. pnlCtlrTitlex.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 2), -1, -1));
  214. pnlCtlr.add(pnlCtlrTitlex, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_FIXED, 1, null, null, null, 0, false));
  215. final JLabel label1 = new JLabel();
  216. Font label1Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label1.getFont());
  217. if (label1Font != null) label1.setFont(label1Font);
  218. label1.setHorizontalAlignment(2);
  219. label1.setHorizontalTextPosition(11);
  220. label1.setIcon(new ImageIcon(getClass().getResource("/static/image/controller.png")));
  221. label1.setText("제어기 정보");
  222. pnlCtlrTitlex.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));
  223. final Spacer spacer1 = new Spacer();
  224. pnlCtlrTitlex.add(spacer1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
  225. pnlControl = new JPanel();
  226. pnlControl.setLayout(new GridLayoutManager(4, 2, new Insets(0, 0, 0, 2), 1, 1));
  227. pnlCtlr.add(pnlControl, 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));
  228. btnDisconnect = new JButton();
  229. Font btnDisconnectFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnDisconnect.getFont());
  230. if (btnDisconnectFont != null) btnDisconnect.setFont(btnDisconnectFont);
  231. btnDisconnect.setText("연결끊기");
  232. pnlControl.add(btnDisconnect, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  233. final JPanel panel1 = new JPanel();
  234. panel1.setLayout(new GridLayoutManager(4, 2, new Insets(0, 0, 0, 0), -1, -1));
  235. pnlControl.add(panel1, new GridConstraints(0, 0, 4, 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));
  236. txtId = new JTextField();
  237. txtId.setEditable(false);
  238. Font txtIdFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtId.getFont());
  239. if (txtIdFont != null) txtId.setFont(txtIdFont);
  240. txtId.setHorizontalAlignment(0);
  241. txtId.setText("ID");
  242. panel1.add(txtId, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), new Dimension(100, -1), new Dimension(100, -1), 0, false));
  243. txtName = new JTextField();
  244. txtName.setEditable(false);
  245. Font txtNameFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtName.getFont());
  246. if (txtNameFont != null) txtName.setFont(txtNameFont);
  247. txtName.setHorizontalAlignment(2);
  248. txtName.setText("제어기 명칭");
  249. panel1.add(txtName, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
  250. final JLabel label2 = new JLabel();
  251. label2.setText("ㅣ관리번호");
  252. panel1.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));
  253. textField1 = new JTextField();
  254. panel1.add(textField1, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
  255. textField2 = new JTextField();
  256. panel1.add(textField2, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
  257. btnReset = new JButton();
  258. Font btnResetFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnReset.getFont());
  259. if (btnResetFont != null) btnReset.setFont(btnResetFont);
  260. btnReset.setText("리셋");
  261. pnlControl.add(btnReset, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  262. btnInitialize = new JButton();
  263. Font btnInitializeFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnInitialize.getFont());
  264. if (btnInitializeFont != null) btnInitialize.setFont(btnInitializeFont);
  265. btnInitialize.setText("초기화");
  266. pnlControl.add(btnInitialize, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  267. btnImage = new JButton();
  268. Font btnImageFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnImage.getFont());
  269. if (btnImageFont != null) btnImage.setFont(btnImageFont);
  270. btnImage.setText("정지영상");
  271. pnlControl.add(btnImage, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  272. final JPanel panel2 = new JPanel();
  273. panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
  274. pnlCtlr.add(panel2, new GridConstraints(1, 1, 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));
  275. pnlLog = new JPanel();
  276. pnlLog.setLayout(new GridLayoutManager(2, 1, new Insets(0, 4, 0, 4), -1, -1));
  277. rootPanel.add(pnlLog, 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_CAN_GROW, null, null, null, 0, false));
  278. pnlLogTitle = new JPanel();
  279. pnlLogTitle.setLayout(new GridLayoutManager(1, 6, new Insets(0, 0, 0, 2), 1, 1));
  280. 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));
  281. final JLabel label3 = new JLabel();
  282. Font label3Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label3.getFont());
  283. if (label3Font != null) label3.setFont(label3Font);
  284. label3.setHorizontalAlignment(2);
  285. label3.setIcon(new ImageIcon(getClass().getResource("/static/image/logging.png")));
  286. label3.setText("제어기 로그");
  287. pnlLogTitle.add(label3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  288. final Spacer spacer2 = new Spacer();
  289. pnlLogTitle.add(spacer2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
  290. btnLogDirOpen = new JButton();
  291. Font btnLogDirOpenFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogDirOpen.getFont());
  292. if (btnLogDirOpenFont != null) btnLogDirOpen.setFont(btnLogDirOpenFont);
  293. btnLogDirOpen.setHorizontalTextPosition(0);
  294. btnLogDirOpen.setText("로그 폴더");
  295. 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));
  296. btnLogPause = new JButton();
  297. Font btnLogPauseFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogPause.getFont());
  298. if (btnLogPauseFont != null) btnLogPause.setFont(btnLogPauseFont);
  299. btnLogPause.setHorizontalTextPosition(0);
  300. btnLogPause.setText("지우기");
  301. 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));
  302. chkLogPause = new JCheckBox();
  303. Font chkLogPauseFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, chkLogPause.getFont());
  304. if (chkLogPauseFont != null) chkLogPause.setFont(chkLogPauseFont);
  305. chkLogPause.setHorizontalAlignment(0);
  306. chkLogPause.setHorizontalTextPosition(11);
  307. chkLogPause.setText("멈춤");
  308. 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));
  309. btnLogCopy = new JButton();
  310. Font btnLogCopyFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogCopy.getFont());
  311. if (btnLogCopyFont != null) btnLogCopy.setFont(btnLogCopyFont);
  312. btnLogCopy.setText("복사");
  313. 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));
  314. final JScrollPane scrollPane1 = new JScrollPane();
  315. Font scrollPane1Font = this.$$$getFont$$$("D2Coding", Font.PLAIN, 12, scrollPane1.getFont());
  316. if (scrollPane1Font != null) scrollPane1.setFont(scrollPane1Font);
  317. pnlLog.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));
  318. taLog = new JTextArea();
  319. taLog.setBackground(new Color(-16777216));
  320. taLog.setCaretColor(new Color(-1));
  321. taLog.setEditable(false);
  322. Font taLogFont = this.$$$getFont$$$("D2Coding", Font.PLAIN, 14, taLog.getFont());
  323. if (taLogFont != null) taLog.setFont(taLogFont);
  324. taLog.setForeground(new Color(-1));
  325. taLog.setMargin(new Insets(4, 4, 4, 4));
  326. 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");
  327. scrollPane1.setViewportView(taLog);
  328. }
  329. /**
  330. * @noinspection ALL
  331. */
  332. private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) {
  333. if (currentFont == null) return null;
  334. String resultName;
  335. if (fontName == null) {
  336. resultName = currentFont.getName();
  337. } else {
  338. Font testFont = new Font(fontName, Font.PLAIN, 10);
  339. if (testFont.canDisplay('a') && testFont.canDisplay('1')) {
  340. resultName = fontName;
  341. } else {
  342. resultName = currentFont.getName();
  343. }
  344. }
  345. Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
  346. boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
  347. Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
  348. return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
  349. }
  350. /**
  351. * @noinspection ALL
  352. */
  353. public JComponent $$$getRootComponent$$$() {
  354. return rootPanel;
  355. }
  356. }