diff --git a/src/main/java/com/insigma/ui/SwingFrame.java b/src/main/java/com/insigma/ui/SwingFrame.java index df04084..415b606 100644 --- a/src/main/java/com/insigma/ui/SwingFrame.java +++ b/src/main/java/com/insigma/ui/SwingFrame.java @@ -39,7 +39,6 @@ import javax.swing.JProgressBar; import javax.swing.JTextPane; import javax.swing.filechooser.FileFilter; import java.awt.Component; -import java.util.function.Function; /** * @author BeiJing-GWY @@ -64,38 +63,35 @@ public class SwingFrame extends JFrame implements ActionListener { * Launch the application. */ public static void run() { - try { - for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { - if ("Nimbus".equals(info.getName())) { - javax.swing.UIManager.setLookAndFeel(info.getClassName()); - break; - } - } - }catch(Exception e) { - System.out.println(e); - - - - - - } -// try {//设置界面样式 Look And Feel -// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); -// } catch (Exception e) { -// e.printStackTrace(); +// try { +// for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { +// if ("Nimbus".equals(info.getName())) { +// javax.swing.UIManager.setLookAndFeel(info.getClassName()); +// break; +// } +// } +// }catch(Exception e) { +// System.out.println(e); // } - EventQueue.invokeLater(() -> { - try { - SwingFrame frame = new SwingFrame(); - frame.setTitle("系统工具"); //设置显示窗口标题 + try {//设置界面样式 Look And Feel + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (Exception e) { + e.printStackTrace(); + } + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + SwingFrame frame = new SwingFrame(); + frame.setTitle("系统工具"); //设置显示窗口标题 // frame.setSize(1600,400);//设置显示窗口大小 // frame.getContentPane().setBackground(Color.blue);//设置显示窗体颜色 - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //设置窗口是否可以关闭 - frame.setBounds(100, 100, 910, 580); - frame.setVisible(true); - frame.setIconImage(Toolkit.getDefaultToolkit().getImage("D:\\JavaSwing\\src\\main\\java\\com\\insigma\\ui\\favicon.jpg")); - } catch (Exception e) { - e.printStackTrace(); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //设置窗口是否可以关闭 + frame.setBounds(100, 100, 930, 580); + frame.setVisible(true); + frame.setIconImage(Toolkit.getDefaultToolkit().getImage("D:\\JavaSwing\\src\\main\\java\\com\\insigma\\ui\\favicon.jpg")); + } catch (Exception e) { + e.printStackTrace(); + } } }); } @@ -112,7 +108,7 @@ public class SwingFrame extends JFrame implements ActionListener { contentPane.setLayout(null); tabbedPane = new JTabbedPane(JTabbedPane.LEFT); - tabbedPane.setBounds(5, 5, 903, 530); + tabbedPane.setBounds(5, 5, 930, 566); tabbedPane.setBackground(Color.WHITE); tabbedPane.setFont(new Font("微软雅黑", Font.PLAIN, 15)); contentPane.add(tabbedPane); @@ -130,8 +126,8 @@ public class SwingFrame extends JFrame implements ActionListener { repairPanel.add(label_5); JButton btnNewButton = new JButton("开始优化"); - btnNewButton.setForeground(Color.WHITE); - btnNewButton.setBackground(new Color(55, 205, 255)); + btnNewButton.setForeground(Color.BLUE); + btnNewButton.setBackground(Color.WHITE); btnNewButton.setFont(new Font("微软雅黑", Font.PLAIN, 20)); btnNewButton.setBorderPainted(false);//去掉按钮的边框的设置 btnNewButton.setBounds(617, 63, 113, 40); @@ -150,29 +146,30 @@ public class SwingFrame extends JFrame implements ActionListener { JCheckBox chckbxNewCheckBox = new JCheckBox("重启服务",true); chckbxNewCheckBox.setBackground(Color.WHITE); - chckbxNewCheckBox.setBounds(53, 130, 162, 27); + chckbxNewCheckBox.setBounds(27, 128, 101, 27); chckbxNewCheckBox.setFont(new Font("微软雅黑", Font.PLAIN, 18)); repairPanel.add(chckbxNewCheckBox); JLabel lblNewLabel_5 = new JLabel("当系统运行慢时,可操作重启应用进行系统重启Tomcat、MySql。"); - lblNewLabel_5.setBounds(77, 166, 573, 18); + lblNewLabel_5.setBounds(24, 164, 446, 18); lblNewLabel_5.setFont(new Font("微软雅黑", Font.PLAIN, 15)); repairPanel.add(lblNewLabel_5); JCheckBox checkBox_1 = new JCheckBox("清除缓存",true); - checkBox_1.setBackground(new Color(220, 220, 220)); - checkBox_1.setBounds(53, 205, 253, 27); + checkBox_1.setBackground(Color.WHITE); + checkBox_1.setBounds(27, 205, 101, 27); checkBox_1.setFont(new Font("微软雅黑", Font.PLAIN, 18)); repairPanel.add(checkBox_1); JLabel label_8 = new JLabel("当系统内存不够,运行缓慢或无法正常升级时,可操作清除缓存和应用缓存。"); - label_8.setBounds(77, 241, 514, 18); + label_8.setBounds(24, 243, 514, 18); label_8.setFont(new Font("微软雅黑", Font.PLAIN, 15)); repairPanel.add(label_8); - - JLabel lblNewLabel_2 = new JLabel("临时测试图片"); - lblNewLabel_2.setIcon(new ImageIcon("D:\\icon\\favicon.jpg")); - lblNewLabel_2.setBounds(34, 309, 240, 185); + JLabel lblNewLabel_2 = new JLabel(); + lblNewLabel_2.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + lblNewLabel_2.setText("清理缓存
释放空间"); + lblNewLabel_2.setIcon(new ImageIcon("C:\\Users\\86177\\Desktop\\\u65B0\u5EFA\u6587\u4EF6\u5939\\\u6E05\u7406.png")); + lblNewLabel_2.setBounds(658, 134, 120, 67); repairPanel.add(lblNewLabel_2); JLabel lblNewLabel_3 = new JLabel("打开服务管理器"); @@ -188,9 +185,24 @@ public class SwingFrame extends JFrame implements ActionListener { } } }); - lblNewLabel_3.setBounds(164, 127, 140, 31); + lblNewLabel_3.setBounds(128, 125, 140, 31); repairPanel.add(lblNewLabel_3); + JLabel label_9 = new JLabel(); + label_9.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + label_9.setText("提高系统
运行速度"); + label_9.setIcon(new ImageIcon("C:\\Users\\86177\\Desktop\\\u65B0\u5EFA\u6587\u4EF6\u5939\\\u8FD0\u884C.png")); + label_9.setBounds(536, 205, 125, 77); + repairPanel.add(label_9); + + JLabel label_13 = new JLabel(); + label_13.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + label_13.setText("重启服务
更新系统"); + label_13.setIcon(new ImageIcon("C:\\Users\\86177\\Desktop\\\u65B0\u5EFA\u6587\u4EF6\u5939\\\u91CD\u542F.png")); + label_13.setBounds(536, 129, 125, 77); + repairPanel.add(label_13); + + JPanel memoryPanel = new JPanel();//调整内存面板 memoryPanel.setBorder(UIManager.getBorder("Button.border")); memoryPanel.setAlignmentX(Component.LEFT_ALIGNMENT); @@ -221,15 +233,18 @@ public class SwingFrame extends JFrame implements ActionListener { JButton btnNewButton_7 = new JButton(msgBtn); btnNewButton_7.setBounds(72, 138, 329, 59); btnNewButton_7.setFont(new Font("微软雅黑", Font.PLAIN, 15)); - btnNewButton_7.addActionListener(e -> { - new WindowsTomcatMysql().setDbSize(200000); + btnNewButton_7.addActionListener(new ActionListener() { + @SneakyThrows + public void actionPerformed(ActionEvent e) { + new WindowsTomcatMysql().setDbSize(200000); - new WindowsTomcatMysql().setMwSize(200000); + new WindowsTomcatMysql().setMwSize(200000); + } }); memoryPanel.add(btnNewButton_7); @@ -298,8 +313,9 @@ public class SwingFrame extends JFrame implements ActionListener { } }); memoryPanel.add(button_3); + JButton btnNewButton_1 = new JButton("保存"); - btnNewButton_1.setForeground(Color.WHITE); + btnNewButton_1.setForeground(Color.BLUE); btnNewButton_1.setFont(new Font("微软雅黑", Font.PLAIN, 20)); btnNewButton_1.setBackground(new Color(55, 205, 255)); btnNewButton_1.setBorderPainted(false);//去掉按钮的边框的设置 @@ -357,11 +373,6 @@ public class SwingFrame extends JFrame implements ActionListener { lblNewLabel_15.setFont(new Font("微软雅黑", Font.PLAIN, 16)); backupsPanel.add(lblNewLabel_15); -// JButton btnNewButton_3 = new JButton("数据库备份"); -// btnNewButton_3.setBounds(32, 351, 113, 27); -// btnNewButton_3.addActionListener(this); -// backupsPanel.add(btnNewButton_3); - JLabel label_11 = new JLabel("数据库还原将覆盖当前系统中所有人为产生的数据,不可恢复,需谨慎操作。
"); label_11.setBounds(382, 55, 238, 74); label_11.setFont(new Font("微软雅黑", Font.PLAIN, 16)); @@ -489,10 +500,6 @@ public class SwingFrame extends JFrame implements ActionListener { lblNewLabel_6.setFont(new Font("微软雅黑", Font.PLAIN, 18)); startRepairPanel.add(lblNewLabel_6); - - - - JProgressBar progressBar = new JProgressBar(); progressBar.setBackground(Color.WHITE); progressBar.setFont(new Font("微软雅黑", Font.PLAIN, 15)); @@ -527,18 +534,34 @@ public class SwingFrame extends JFrame implements ActionListener { startRepairPanel.add(lblNewLabel_7); JScrollPane scrollPane = new JScrollPane(); - scrollPane.setBounds(57, 152, 539, 338); + scrollPane.setBounds(57, 152, 425, 338); startRepairPanel.add(scrollPane); JTextPane textPane = new JTextPane(); scrollPane.setViewportView(textPane); + JLabel label_14 = new JLabel(); + label_14.setIcon(new ImageIcon("C:\\Users\\86177\\Desktop\\\u65B0\u5EFA\u6587\u4EF6\u5939\\\u91CD\u542F.png")); + label_14.setText("重启服务
更新系统"); + label_14.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + label_14.setBounds(496, 152, 125, 77); + startRepairPanel.add(label_14); + + JLabel label_15 = new JLabel(); + label_15.setIcon(new ImageIcon("C:\\Users\\86177\\Desktop\\\u65B0\u5EFA\u6587\u4EF6\u5939\\\u6E05\u7406.png")); + label_15.setText("清理缓存
释放空间"); + label_15.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + label_15.setBounds(639, 157, 120, 67); + startRepairPanel.add(label_15); + + JLabel label_16 = new JLabel(); + label_16.setIcon(new ImageIcon("C:\\Users\\86177\\Desktop\\\u65B0\u5EFA\u6587\u4EF6\u5939\\\u8FD0\u884C.png")); + label_16.setText("提高系统
运行速度"); + label_16.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + label_16.setBounds(506, 242, 125, 77); + startRepairPanel.add(label_16); + startBackupPanel = new JPanel();//执行数据库备份面板 startBackupPanel.setBackground(Color.WHITE); - - - - - startBackupPanel.setLayout(null); @@ -554,7 +577,9 @@ public class SwingFrame extends JFrame implements ActionListener { JButton btnNewButton_5 = new JButton("更改"); - btnNewButton_5.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + btnNewButton_5.setBackground(Color.BLUE); + btnNewButton_5.setForeground(Color.BLUE); + btnNewButton_5.setFont(new Font("微软雅黑", Font.PLAIN, 20)); btnNewButton_5.setBounds(356, 103, 73, 24); btnNewButton_5.addActionListener(new ActionListener() { @Override @@ -578,7 +603,7 @@ public class SwingFrame extends JFrame implements ActionListener { startBackupPanel.add(lblNewLabel_19); JButton btnNewButton_6 = new JButton("开始备份"); - btnNewButton_6.setForeground(Color.WHITE); + btnNewButton_6.setForeground(Color.BLUE); btnNewButton_6.setFont(new Font("微软雅黑", Font.PLAIN, 20)); btnNewButton_6.setBackground(new Color(55, 205, 255)); btnNewButton_6.setBounds(606, 98, 113, 35); @@ -627,8 +652,10 @@ public class SwingFrame extends JFrame implements ActionListener { label.setBounds(14, 57, 100, 27); startRestorePanel.add(label); - JButton button_5 = new JButton("上传文件:"); - button_5.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + JButton button_5 = new JButton("上传:"); + button_5.setBackground(Color.BLUE); + button_5.setForeground(Color.BLUE); + button_5.setFont(new Font("微软雅黑", Font.PLAIN, 20)); button_5.setBounds(14, 97, 120, 24); button_5.addActionListener(new ActionListener() { @Override @@ -673,7 +700,7 @@ public class SwingFrame extends JFrame implements ActionListener { startRestorePanel.add(label_2); JButton button_6 = new JButton("开始还原"); - button_6.setForeground(Color.WHITE); + button_6.setForeground(Color.blue); button_6.setFont(new Font("微软雅黑", Font.PLAIN, 20)); button_6.setBackground(new Color(55, 205, 255)); button_6.setBounds(594, 90, 113, 35);