From fba696834a6f37727b0494530c403454ccf12663 Mon Sep 17 00:00:00 2001 From: lixl1 Date: Fri, 29 Apr 2022 15:51:29 +0800 Subject: [PATCH] =?UTF-8?q?javaswing=E7=B3=BB=E7=BB=9F=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95=E6=8C=89=E9=92=AE=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pictureIcon/Rectanglex 2.png | Bin 0 -> 679 bytes pictureIcon/shujukubeifen.png | Bin 0 -> 1296 bytes pictureIcon/syq-unselect.png | Bin 0 -> 1032 bytes pictureIcon/youhua2.png | Bin 0 -> 1349 bytes src/main/java/com/insigma/ui/SwingFrame.java | 58 +++++++++++++++---- 5 files changed, 48 insertions(+), 10 deletions(-) create mode 100644 pictureIcon/Rectanglex 2.png create mode 100644 pictureIcon/shujukubeifen.png create mode 100644 pictureIcon/syq-unselect.png create mode 100644 pictureIcon/youhua2.png diff --git a/pictureIcon/Rectanglex 2.png b/pictureIcon/Rectanglex 2.png new file mode 100644 index 0000000000000000000000000000000000000000..bda18bd40b75929ffc987c5229868f52258185fc GIT binary patch literal 679 zcmV;Y0$BZtP) z+WN@`fkjrZO^FTL`qCYrCbHfjF^>nqQ*iYj=};-3ac?nbSlNki*R+h&&mGpjq`X%E zb`$7|Y3t5<&`^a%2I#A_^{vYJLDt<>W_s%<22Gl_epIbnF0&^Ul#U{NFO;Bl+-X*Dz!pbsH+x7vQ0?wkrk;{#TpAF;HwSDx)E zEJNc3Rw(b_7WPPIM=7}XiZz!}qJb-IW3w-s8^xY-0aP zcDTAn1E>1H^%^Le{XK)95Gla|KNl7*o;csF9**$S<{xQOJ|-L(u#7b=5g$;9eFN#_ z%UZjyQfX5P1poIyfO@5^KW^EP0w^%(g$Pv2iR2kMOmne`rn<6veaM2yBJgxn`TSB% z&$t6%OBCR&w2d_Zjly$TZxYN$A^=x^z>Pw}e)){|kimWbFfcUJM6EFA@J6J(Hvo1v zSYdc-qi<1x0Jp2jtvZf?AG2+`u{=IDb1tp5#~BcxlU8bFplbQ#{TpzJcPu705aj>> N002ovPDHLkV1jS!H(me$ literal 0 HcmV?d00001 diff --git a/pictureIcon/shujukubeifen.png b/pictureIcon/shujukubeifen.png new file mode 100644 index 0000000000000000000000000000000000000000..c11784bb2ca44b2164eda66d5c209d26a50cdd2e GIT binary patch literal 1296 zcmV+r1@HQaP)C# zs!~buPyq)`E<9>%=4f5 z&&)F;{LdoSf~Pe#;|PV8A^I3_FEACD0JI}qLghH32MLb(NXpCq9O=#x0X3BxkK6Mi zPzBuBe^Dp!8_FNRM1;w}bpvN24Y+KQX!K$};9&tZWj%yTJx~JrJ4g)%dpOf}Og3+J zvzMu=;5c(K(F@O_l%QP3V55Z1#8A+@fSR(`p!yz)0$cgJYnxP6b&N*8Ha3Rn>R5~N zIxrrn=4{*g!4CQW)v=;L5;%`bnV9A`qX7*)SIe4>!H2*slpPW^pU>*#0QTqXXP}UP zE|iLx_xnGI+V*6GuRy0GtjW^rkFc(83hDF|G0o#X&+F@pNv9VO;MPnLDebsiq|iMg zD`V$<`nEj-(G#fl5bT*H74Zw#))tM8W9jU83-IVJ%oDPUupdc3EtT=M!RK0Qzkuo+ zz%GfH@eH7Pp7(ZdMQN2t%)2;8)NwX}yJd84Mf78!U_?-nO%jg2>bFn6hR92qTxuWBI{@z$fq>4Hir7h?Q6g~{ z!9W$FrD!IH;}E%uauM_hE|!?){(KH;GC7Zc90Th6D6O>|lrV-YgTN)Jto$yA7Td1C zFus*=_|!ndH#Uxyva+s$|B1v61dXsn%O#g96-rrIub&cY zr$-0KA<#ppG$V2uT(7ykXy^Ac)GQJ6?z~Yt)@ko4%mN-pnJW>qXc*;f!1`+_nxhhl z-k<*t+w19RS->w*N|}0lNJ>k4d=c*6eG>)22GB=_2bEJOt0Wrra^(|stX8k3`T!lP z23Sj=V1`sw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~f;^00000NkvXX Hu0mjf7;l3o literal 0 HcmV?d00001 diff --git a/src/main/java/com/insigma/ui/SwingFrame.java b/src/main/java/com/insigma/ui/SwingFrame.java index e9936d2..6ee9879 100644 --- a/src/main/java/com/insigma/ui/SwingFrame.java +++ b/src/main/java/com/insigma/ui/SwingFrame.java @@ -1,25 +1,21 @@ package com.insigma.ui; - import com.insigma.service.Computer; import com.insigma.service.Database; import com.insigma.service.Middleware; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; - import javax.swing.border.EmptyBorder; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; - import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JButton; import java.awt.Panel; import java.awt.Toolkit; - import javax.swing.JTabbedPane; import java.awt.Font; import javax.swing.JTextField; @@ -37,6 +33,8 @@ import javax.swing.JCheckBox; import javax.swing.JFileChooser; import javax.swing.JProgressBar; import javax.swing.JTextPane; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import javax.swing.filechooser.FileFilter; import java.awt.Component; @@ -44,7 +42,7 @@ import java.awt.Component; * @author BeiJing-GWY */ @Slf4j -public class SwingFrame extends JFrame implements ActionListener { +public class SwingFrame extends JFrame implements ActionListener, ChangeListener { // 计算机 private static Computer computer; @@ -129,7 +127,11 @@ public class SwingFrame extends JFrame implements ActionListener { repairPanel = new JPanel();//系统优化面板 repairPanel.setForeground(Color.WHITE); repairPanel.setBackground(Color.WHITE); - tabbedPane.addTab("系统优化", null, repairPanel, null); + tabbedPane.addTab("系统优化", new ImageIcon("pictureIcon/youhua2.png"), repairPanel, "repairPanel"); + tabbedPane.setEnabledAt(0, true); + tabbedPane.setFont(new Font("微软雅黑", Font.PLAIN, 22)); + tabbedPane.setForegroundAt(0, new Color(30, 144, 255)); + tabbedPane.addChangeListener(this); repairPanel.setLayout(null); JLabel label_5 = new JLabel("系统优化"); @@ -212,12 +214,15 @@ public class SwingFrame extends JFrame implements ActionListener { repairPanel.add(label_13); - JPanel memoryPanel = new JPanel();//调整内存面板 + JPanel memoryPanel = new JPanel();//调整内存 memoryPanel.setBorder(UIManager.getBorder("Button.border")); memoryPanel.setAlignmentX(Component.LEFT_ALIGNMENT); memoryPanel.setForeground(Color.WHITE); memoryPanel.setBackground(Color.WHITE); - tabbedPane.addTab("调整内存", null, memoryPanel, null); + tabbedPane.addTab("调整内存", new ImageIcon("pictureIcon/Rectanglex 2.png"), memoryPanel, "memoryPanel"); + tabbedPane.setEnabledAt(0, true); + tabbedPane.setFont(new Font("微软雅黑", Font.PLAIN, 22)); + tabbedPane.addChangeListener(this); memoryPanel.setLayout(null); JLabel lblNewLabel = new JLabel("调整内存"); @@ -314,7 +319,10 @@ public class SwingFrame extends JFrame implements ActionListener { backupsPanel = new JPanel();//数据库备份、还原面板 backupsPanel.setBackground(Color.WHITE); - tabbedPane.addTab("数据库备份", null, backupsPanel, null); + tabbedPane.addTab("数据库份", new ImageIcon("pictureIcon/shujukubeifen.png"), backupsPanel, "backupsPanel"); + tabbedPane.setEnabledAt(0, true); + tabbedPane.setFont(new Font("微软雅黑", Font.PLAIN, 22)); + tabbedPane.addChangeListener(this); backupsPanel.setLayout(null); JLabel lblNewLabel_12 = new JLabel("数据库备份"); @@ -406,7 +414,10 @@ public class SwingFrame extends JFrame implements ActionListener { Panel upgradePanel = new Panel();//系统升级面板 upgradePanel.setBackground(Color.WHITE); - tabbedPane.addTab("系统升级", null, upgradePanel, null); + tabbedPane.addTab("系统升级", new ImageIcon("pictureIcon/syq-unselect.png"), upgradePanel, "upgradePanel"); + tabbedPane.setEnabledAt(0, true); + tabbedPane.setFont(new Font("微软雅黑", Font.PLAIN, 22)); + tabbedPane.addChangeListener(this); upgradePanel.setLayout(null); JLabel lblNewLabel_8 = new JLabel("安装包/升级包下载"); @@ -754,4 +765,31 @@ public class SwingFrame extends JFrame implements ActionListener { } } } + + @Override + public void stateChanged(ChangeEvent e) { + JTabbedPane pane = (JTabbedPane) e.getSource(); + int selectedIndex = pane.getSelectedIndex(); + if(selectedIndex == 0) { + tabbedPane.setForegroundAt(0, new Color(30, 144, 255)); + tabbedPane.setForegroundAt(1, Color.black); + tabbedPane.setForegroundAt(2, Color.black); + tabbedPane.setForegroundAt(3, Color.black); + }else if(selectedIndex == 1) { + tabbedPane.setForegroundAt(1, new Color(30, 144, 255)); + tabbedPane.setForegroundAt(0, Color.black); + tabbedPane.setForegroundAt(2, Color.black); + tabbedPane.setForegroundAt(3, Color.black); + }else if(selectedIndex == 2) { + tabbedPane.setForegroundAt(2, new Color(30, 144, 255)); + tabbedPane.setForegroundAt(1, Color.black); + tabbedPane.setForegroundAt(0, Color.black); + tabbedPane.setForegroundAt(3, Color.black); + }else if(selectedIndex == 3) { + tabbedPane.setForegroundAt(3, new Color(30, 144, 255)); + tabbedPane.setForegroundAt(1, Color.black); + tabbedPane.setForegroundAt(2, Color.black); + tabbedPane.setForegroundAt(0, Color.black); + } + } } \ No newline at end of file