diff --git a/pictureIcon/Rectanglex 2.png b/pictureIcon/Rectanglex 2.png new file mode 100644 index 0000000..bda18bd Binary files /dev/null and b/pictureIcon/Rectanglex 2.png differ diff --git a/pictureIcon/shujukubeifen.png b/pictureIcon/shujukubeifen.png new file mode 100644 index 0000000..c11784b Binary files /dev/null and b/pictureIcon/shujukubeifen.png differ diff --git a/pictureIcon/syq-unselect.png b/pictureIcon/syq-unselect.png new file mode 100644 index 0000000..8908c62 Binary files /dev/null and b/pictureIcon/syq-unselect.png differ diff --git a/pictureIcon/youhua2.png b/pictureIcon/youhua2.png new file mode 100644 index 0000000..a79d3e6 Binary files /dev/null and b/pictureIcon/youhua2.png differ 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