diff --git a/src/main/java/com/insigma/ui/SwingFrame.java b/src/main/java/com/insigma/ui/SwingFrame.java
index 70e4060..76b195c 100644
--- a/src/main/java/com/insigma/ui/SwingFrame.java
+++ b/src/main/java/com/insigma/ui/SwingFrame.java
@@ -1,6 +1,7 @@
package com.insigma.ui;
import com.insigma.service.impl.WindowsTomcatMysql;
+import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import javax.swing.border.EmptyBorder;
@@ -66,41 +67,49 @@ 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, 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();
+ }
}
});
}
/**
* Create the frame.
+ * @throws IOException
*/
- public SwingFrame() {
+ public SwingFrame() throws IOException {
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
@@ -114,19 +123,22 @@ public class SwingFrame extends JFrame implements ActionListener {
contentPane.add(tabbedPane);
repairPanel = new JPanel();//系统优化面板
- repairPanel.setForeground(Color.GRAY);
- repairPanel.setBackground(new Color(220, 220, 220));
+ repairPanel.setForeground(Color.WHITE);
+ repairPanel.setBackground(Color.WHITE);
tabbedPane.addTab("系统优化", null, repairPanel, null);
repairPanel.setLayout(null);
JLabel label_5 = new JLabel("系统优化");
label_5.setBounds(42, 35, 120, 40);
- label_5.setForeground(Color.RED);
+ label_5.setForeground(new Color(0, 0, 0));
label_5.setFont(new Font("微软雅黑", Font.PLAIN, 30));
repairPanel.add(label_5);
JButton btnNewButton = new JButton("开始优化");
- btnNewButton.setFont(new Font("微软雅黑", Font.PLAIN, 15));
+ btnNewButton.setForeground(Color.WHITE);
+ btnNewButton.setBackground(new Color(55, 205, 255));
+ btnNewButton.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+ btnNewButton.setBorderPainted(false);//去掉按钮的边框的设置
btnNewButton.setBounds(617, 63, 113, 40);
btnNewButton.addActionListener(this);
repairPanel.add(btnNewButton);
@@ -137,12 +149,12 @@ public class SwingFrame extends JFrame implements ActionListener {
repairPanel.add(label_6);
JSeparator separator_1 = new JSeparator();
- separator_1.setBackground(Color.LIGHT_GRAY);
+ separator_1.setBackground(Color.WHITE);
separator_1.setBounds(27, 116, 715, 5);
repairPanel.add(separator_1);
JCheckBox chckbxNewCheckBox = new JCheckBox("重启服务",true);
- chckbxNewCheckBox.setBackground(new Color(220, 220, 220));
+ chckbxNewCheckBox.setBackground(Color.WHITE);
chckbxNewCheckBox.setBounds(53, 130, 162, 27);
chckbxNewCheckBox.setFont(new Font("微软雅黑", Font.PLAIN, 18));
repairPanel.add(chckbxNewCheckBox);
@@ -168,23 +180,33 @@ public class SwingFrame extends JFrame implements ActionListener {
lblNewLabel_2.setBounds(34, 309, 240, 185);
repairPanel.add(lblNewLabel_2);
- JButton btnNewButton_8 = new JButton("打开服务管理器");
- btnNewButton_8.setFont(new Font("微软雅黑", Font.PLAIN, 15));
- btnNewButton_8.setBounds(582, 132, 148, 40);
- btnNewButton_8.addActionListener(this);
- repairPanel.add(btnNewButton_8);
+ JLabel lblNewLabel_3 = new JLabel("打开服务管理器");
+ lblNewLabel_3.setForeground(new Color(30, 144, 255));
+ lblNewLabel_3.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+ lblNewLabel_3.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ try{
+ new WindowsTomcatMysql().openServer();
+ }catch (Exception ex){
+ ex.printStackTrace();
+ }
+ }
+ });
+ lblNewLabel_3.setBounds(164, 127, 140, 31);
+ repairPanel.add(lblNewLabel_3);
JPanel memoryPanel = new JPanel();//调整内存面板
memoryPanel.setBorder(UIManager.getBorder("Button.border"));
memoryPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
- memoryPanel.setForeground(Color.GRAY);
- memoryPanel.setBackground(new Color(220, 220, 220));
+ memoryPanel.setForeground(Color.WHITE);
+ memoryPanel.setBackground(Color.WHITE);
tabbedPane.addTab("调整内存", null, memoryPanel, null);
memoryPanel.setLayout(null);
JLabel lblNewLabel = new JLabel("调整内存");
lblNewLabel.setBounds(60, 31, 125, 34);
- lblNewLabel.setForeground(Color.RED);
+ lblNewLabel.setForeground(Color.BLACK);
lblNewLabel.setFont(new Font("微软雅黑", Font.PLAIN, 30));
memoryPanel.add(lblNewLabel);
@@ -204,16 +226,17 @@ 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 -> {
- try {
+ btnNewButton_7.addActionListener(new ActionListener() {
+ @SneakyThrows
+ public void actionPerformed(ActionEvent e) {
new WindowsTomcatMysql().setDbSize(200000);
- } catch (Exception exception) {
- exception.printStackTrace();
- }
- try {
+
+
+
+
new WindowsTomcatMysql().setMwSize(200000);
- } catch (Exception exception) {
- exception.printStackTrace();
+
+
}
});
memoryPanel.add(btnNewButton_7);
@@ -224,16 +247,17 @@ public class SwingFrame extends JFrame implements ActionListener {
JButton button_1 = new JButton(msgBtn16G);
button_1.setBounds(72, 227, 329, 59);
button_1.setFont(new Font("微软雅黑", Font.PLAIN, 15));
- button_1.addActionListener(e -> {
- try {
+ button_1.addActionListener(new ActionListener() {
+ @SneakyThrows
+ public void actionPerformed(ActionEvent e) {
new WindowsTomcatMysql().setDbSize(160000);
- } catch (Exception exception) {
- exception.printStackTrace();
- }
- try {
+
+
+
+
new WindowsTomcatMysql().setMwSize(160000);
- } catch (Exception exception) {
- exception.printStackTrace();
+
+
}
});
memoryPanel.add(button_1);
@@ -244,16 +268,17 @@ public class SwingFrame extends JFrame implements ActionListener {
JButton button_2 = new JButton(msgBtn8G);
button_2.setBounds(72, 314, 329, 59);
button_2.setFont(new Font("微软雅黑", Font.PLAIN, 15));
- button_2.addActionListener(e -> {
- try {
+ button_2.addActionListener(new ActionListener() {
+ @SneakyThrows
+ public void actionPerformed(ActionEvent e) {
new WindowsTomcatMysql().setDbSize(80000);
- } catch (Exception exception) {
- exception.printStackTrace();
- }
- try {
+
+
+
+
new WindowsTomcatMysql().setMwSize(80000);
- } catch (Exception exception) {
- exception.printStackTrace();
+
+
}
});
memoryPanel.add(button_2);
@@ -264,37 +289,44 @@ public class SwingFrame extends JFrame implements ActionListener {
JButton button_3 = new JButton(msgBtn4G);
button_3.setBounds(72, 399, 329, 59);
button_3.setFont(new Font("微软雅黑", Font.PLAIN, 15));
- button_3.addActionListener(e -> {
- try {
+ button_3.addActionListener(new ActionListener() {
+ @SneakyThrows
+ public void actionPerformed(ActionEvent e) {
new WindowsTomcatMysql().setDbSize(40000);
- } catch (Exception exception) {
- exception.printStackTrace();
- }
- try {
+
+
+
+
new WindowsTomcatMysql().setMwSize(40000);
- } catch (Exception exception) {
- exception.printStackTrace();
+
+
}
});
memoryPanel.add(button_3);
JButton btnNewButton_1 = new JButton("保存");
+ btnNewButton_1.setForeground(Color.WHITE);
+ btnNewButton_1.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+ btnNewButton_1.setBackground(new Color(55, 205, 255));
+ btnNewButton_1.setBorderPainted(false);//去掉按钮的边框的设置
btnNewButton_1.setBounds(566, 472, 113, 40);
- btnNewButton_1.addActionListener(e -> {
- //暂定保存内容
+ btnNewButton_1.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ //暂定保存内容
+ }
});
-// btnNewButton_1.setContentAreaFilled(false);//按钮设置为透明
-// btnNewButton_1.setBorder(BorderFactory.createRaisedBevelBorder());//设置凸起来的按钮
-// btnNewButton_1.setBorder(BorderFactory.createLoweredBevelBorder()); //设置凹起来的按钮
-// btnNewButton_1.setBorderPainted(false);//去掉按钮的边框的设置
-// String path = "C:\\Users\\86177\\Desktop\\www.png";
-// File file = new File(path);
-// Image image = ImageIO.read(file);
-// btnNewButton_1.setIcon(new ImageIcon(image.getScaledInstance(50, 50, image.SCALE_DEFAULT)));
- btnNewButton_1.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+
+
+
+
+
+
+
+
+
memoryPanel.add(btnNewButton_1);
backupsPanel = new JPanel();//数据库备份、还原面板
- backupsPanel.setBackground(new Color(220, 220, 220));
+ backupsPanel.setBackground(Color.WHITE);
tabbedPane.addTab("数据库备份", null, backupsPanel, null);
backupsPanel.setLayout(null);
@@ -330,10 +362,10 @@ 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);
+// 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);
@@ -345,22 +377,57 @@ public class SwingFrame extends JFrame implements ActionListener {
label_12.setFont(new Font("微软雅黑", Font.PLAIN, 16));
backupsPanel.add(label_12);
- JButton button = new JButton("数据库还原");
- button.setBounds(451, 351, 113, 27);
- button.addActionListener(this);
- backupsPanel.add(button);
+// JButton button = new JButton("数据库还原");
+// button.setBounds(451, 351, 113, 27);
+// button.addActionListener(this);
+// backupsPanel.add(button);
- JLabel lblNewLabel_16 = new JLabel("注:当系统遇到极端情况导致无法登陆时,系统卸载可进行数据库备份,重装或升级之后进行数据库还原。");
+ JLabel lblNewLabel_16 = new JLabel("注:当系统遇到极端情况导致无法登陆时,系统卸载可进行数据库备份,重装或升级之后进行数据库还原。");
+ lblNewLabel_16.setForeground(Color.GREEN);
lblNewLabel_16.setFont(new Font("微软雅黑", Font.PLAIN, 15));
lblNewLabel_16.setBounds(14, 494, 710, 18);
backupsPanel.add(lblNewLabel_16);
+ JLabel label_1 = new JLabel("数据库备份");
+ label_1.setForeground(new Color(30, 144, 255));
+ label_1.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+ label_1.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ try{
+ tabbedPane.addTab("数据库备份", null, startBackupPanel, null);
+ tabbedPane.setSelectedComponent(startBackupPanel);
+ }catch (Exception ex){
+ ex.printStackTrace();
+ }
+ }
+ });
+ label_1.setBounds(32, 377, 105, 31);
+ backupsPanel.add(label_1);
+
+ JLabel label_3 = new JLabel("数据库还原");
+ label_3.setForeground(new Color(30, 144, 255));
+ label_3.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+ label_3.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ try{
+ tabbedPane.addTab("数据库还原", null, startRestorePanel, null);
+ tabbedPane.setSelectedComponent(startRestorePanel);
+ }catch (Exception ex){
+ ex.printStackTrace();
+ }
+ }
+ });
+ label_3.setBounds(451, 377, 105, 31);
+ backupsPanel.add(label_3);
+
Panel upgradePanel = new Panel();//系统升级面板
- upgradePanel.setBackground(new Color(220, 220, 220));
+ upgradePanel.setBackground(Color.WHITE);
tabbedPane.addTab("系统升级", null, upgradePanel, null);
upgradePanel.setLayout(null);
- JLabel lblNewLabel_8 = new JLabel("安装包/升级包下载");
+ JLabel lblNewLabel_8 = new JLabel("安装包/升级包下载");
lblNewLabel_8.setFont(new Font("微软雅黑", Font.PLAIN, 20));
lblNewLabel_8.setBounds(47, 47, 181, 28);
upgradePanel.add(lblNewLabel_8);
@@ -370,7 +437,7 @@ public class SwingFrame extends JFrame implements ActionListener {
lblNewLabel_9.setBounds(57, 88, 420, 18);
upgradePanel.addMouseListener(new MouseAdapter() {
- @Override
+
public void mouseClicked(MouseEvent e){ //鼠标点击事件
@SuppressWarnings("unused")
URI uri = null;
@@ -393,19 +460,19 @@ public class SwingFrame extends JFrame implements ActionListener {
}
}
- @Override
+
public void mouseEntered(MouseEvent e) { //鼠标移入事件
lblNewLabel_9.setForeground(Color.red);
}
- @Override
+
public void mouseExited(MouseEvent e) { //鼠标移出事件
- lblNewLabel_9.setForeground(Color.blue);
+ lblNewLabel_9.setForeground(new Color(30, 144, 255));
}
});
upgradePanel.add(lblNewLabel_9);
- JLabel lblNewLabel_10 = new JLabel("客服电话:400-8600-797-1、400-9608-590-5。");
+ JLabel lblNewLabel_10 = new JLabel("客服电话:400-8600-797-1、400-9608-590-5。");
lblNewLabel_10.setFont(new Font("微软雅黑", Font.PLAIN, 20));
lblNewLabel_10.setBounds(47, 161, 462, 28);
upgradePanel.add(lblNewLabel_10);
@@ -416,21 +483,23 @@ public class SwingFrame extends JFrame implements ActionListener {
upgradePanel.add(lblNewLabel_11);
startRepairPanel = new JPanel();
- startRepairPanel.setBackground(new Color(220, 220, 220));
+ startRepairPanel.setBackground(Color.WHITE);
startRepairPanel.setLayout(null);
- lblNewLabel_6 = new JLabel("系统正在加速优化中,建议不要随意随意操作停止!");
- lblNewLabel_6.setBounds(57, 34, 378, 18);
+ lblNewLabel_6 = new JLabel("系统正在加速优化中,建议不要随意随意操作关闭!");
+ lblNewLabel_6.setBounds(57, 34, 446, 18);
lblNewLabel_6.setForeground(new Color(255, 0, 0));
lblNewLabel_6.setFont(new Font("微软雅黑", Font.PLAIN, 18));
startRepairPanel.add(lblNewLabel_6);
- JButton btnNewButton_2 = new JButton("停止优化");
- btnNewButton_2.setBounds(495, 65, 113, 27);
- startRepairPanel.add(btnNewButton_2);
+
+
+
JProgressBar progressBar = new JProgressBar();
+ progressBar.setBackground(Color.WHITE);
+ progressBar.setFont(new Font("微软雅黑", Font.PLAIN, 15));
// MyJProgressBar progressBar = new MyJProgressBar();
- progressBar.setBounds(57, 65, 412, 27);
+ progressBar.setBounds(57, 65, 555, 27);
// 设置进度的 最小值 和 最大值
progressBar.setMinimum(MIN_PROGRESS);
progressBar.setMaximum(MAX_PROGRESS);
@@ -439,10 +508,13 @@ public class SwingFrame extends JFrame implements ActionListener {
// 绘制百分比文本(进度条中间显示的百分数)
progressBar.setStringPainted(true);
// 添加进度改变通知
- progressBar.addChangeListener(e -> {
- // System.out.println("当前进度值: " + progressBar.getValue() + "; " +
- // "进度百分比: " + progressBar.getPercentComplete());
- });
+// progressBar.addChangeListener(new ChangeListener() {
+// @Override
+// public void stateChanged(ChangeEvent e) {
+// // System.out.println("当前进度值: " + progressBar.getValue() + "; " +
+// // "进度百分比: " + progressBar.getPercentComplete());
+// }
+// });
// 添加到内容面板
startRepairPanel.add(progressBar);
@@ -463,122 +535,186 @@ public class SwingFrame extends JFrame implements ActionListener {
scrollPane.setViewportView(textPane);
startBackupPanel = new JPanel();//执行数据库备份面板
- startBackupPanel.setBackground(new Color(220, 220, 220));
+ startBackupPanel.setBackground(Color.WHITE);
+
+
+
+
- JButton btnNewButton_4 = new JButton("返回");
- btnNewButton_4.setFont(new Font("微软雅黑", Font.PLAIN, 15));
- btnNewButton_4.setBounds(14, 13, 113, 35);
- btnNewButton_4.addActionListener(this);
startBackupPanel.setLayout(null);
- startBackupPanel.add(btnNewButton_4);
+
JLabel lblNewLabel_17 = new JLabel("数据库备份");
- lblNewLabel_17.setBounds(94, 60, 100, 27);
+ lblNewLabel_17.setBounds(27, 62, 100, 27);
lblNewLabel_17.setFont(new Font("微软雅黑", Font.PLAIN, 20));
startBackupPanel.add(lblNewLabel_17);
JLabel lblNewLabel_18 = new JLabel("存储目录:");
- lblNewLabel_18.setBounds(71, 90, 85, 27);
+ lblNewLabel_18.setBounds(27, 102, 85, 27);
lblNewLabel_18.setFont(new Font("微软雅黑", Font.PLAIN, 15));
startBackupPanel.add(lblNewLabel_18);
JButton btnNewButton_5 = new JButton("更改");
btnNewButton_5.setFont(new Font("微软雅黑", Font.PLAIN, 15));
- btnNewButton_5.setBounds(486, 91, 100, 24);
- btnNewButton_5.addActionListener(e -> {
- JFileChooser jfC = new JFileChooser();
-// jfC.setMultiSelectionEnabled(true);//文件是否多选!参数为true或false
- jfC.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);//设置文件的打开模式(只能选文件夹)
- jfC.setDialogTitle("请选择要上传的文件夹");
- int value = jfC.showOpenDialog(SwingFrame.this);
- if(value == JFileChooser.APPROVE_OPTION) {
- File dirFile = jfC.getSelectedFile();//返回选中的文件
- textField_5.setText(dirFile.getAbsolutePath());
+ btnNewButton_5.setBounds(356, 103, 73, 24);
+ btnNewButton_5.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ JFileChooser jfC = new JFileChooser();
+// jfC.setMultiSelectionEnabled(true);//文件是否多选!参数为true或false
+ jfC.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);//设置文件的打开模式(只能选文件夹)
+ jfC.setDialogTitle("请选择要上传的文件夹");
+ int value = jfC.showOpenDialog(SwingFrame.this);
+ if(value == JFileChooser.APPROVE_OPTION) {
+ File dirFile = jfC.getSelectedFile();//返回选中的文件
+ textField_5.setText(dirFile.getAbsolutePath());
+ }
}
});
startBackupPanel.add(btnNewButton_5);
JLabel lblNewLabel_19 = new JLabel("数据库备份的格式为“zip”");
- lblNewLabel_19.setBounds(170, 120, 186, 18);
+ lblNewLabel_19.setBounds(114, 136, 186, 18);
lblNewLabel_19.setFont(new Font("微软雅黑", Font.PLAIN, 15));
startBackupPanel.add(lblNewLabel_19);
JButton btnNewButton_6 = new JButton("开始备份");
- btnNewButton_6.setFont(new Font("微软雅黑", Font.PLAIN, 15));
- btnNewButton_6.setBounds(206, 186, 113, 35);
- btnNewButton_6.addActionListener(e -> {
+ btnNewButton_6.setForeground(Color.WHITE);
+ btnNewButton_6.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+ btnNewButton_6.setBackground(new Color(55, 205, 255));
+ btnNewButton_6.setBounds(606, 98, 113, 35);
+ btnNewButton_6.setBorderPainted(false);//去掉按钮的边框的设置
+ btnNewButton_6.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ }
});
startBackupPanel.add(btnNewButton_6);
textField_5 = new JTextField();
- textField_5.setBounds(170, 92, 319, 24);
+ textField_5.setBounds(114, 103, 245, 24);
textField_5.setFont(new Font("微软雅黑", Font.PLAIN, 15));
startBackupPanel.add(textField_5);
textField_5.setColumns(10);
+ JLabel label_7 = new JLabel("返回");
+ label_7.setForeground(new Color(30, 144, 255));
+ label_7.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+ label_7.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ try{
+ tabbedPane.setSelectedComponent(backupsPanel);
+ }catch (Exception ex){
+ ex.printStackTrace();
+ }
+ }
+ });
+ label_7.setBounds(27, 13, 53, 31);
+ startBackupPanel.add(label_7);
startRestorePanel = new JPanel();
startRestorePanel.setLayout(null);
- startRestorePanel.setBackground(new Color(220, 220, 220));
+ startRestorePanel.setBackground(Color.WHITE);
- JButton button_4 = new JButton("返回");
- button_4.setFont(new Font("微软雅黑", Font.PLAIN, 15));
- button_4.setBounds(14, 13, 113, 35);
- button_4.addActionListener(this);
- startRestorePanel.add(button_4);
+// JButton button_4 = new JButton("返回");
+// button_4.setFont(new Font("微软雅黑", Font.PLAIN, 15));
+// button_4.setBounds(14, 13, 113, 35);
+// button_4.addActionListener(this);
+// startRestorePanel.add(button_4);
JLabel label = new JLabel("数据库还原");
label.setFont(new Font("微软雅黑", Font.PLAIN, 20));
- label.setBounds(94, 60, 100, 27);
+ label.setBounds(14, 57, 100, 27);
startRestorePanel.add(label);
JButton button_5 = new JButton("上传文件:");
button_5.setFont(new Font("微软雅黑", Font.PLAIN, 15));
- button_5.setBounds(94, 91, 116, 24);
- button_5.addActionListener(e -> {
- JFileChooser jfC = new JFileChooser();
- jfC.setFileFilter(new FileFilter() {
- @Override
- public String getDescription() {
- return "ZIP压缩文件(*.zip)";
- }
- @Override
- public boolean accept(File f) {
- return f.getName().toLowerCase().endsWith(".zip");
+ button_5.setBounds(14, 97, 120, 24);
+ button_5.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ JFileChooser jfC = new JFileChooser();
+ jfC.setFileFilter(new FileFilter() {
+ @Override
+ public String getDescription() {
+ return "ZIP压缩文件(*.zip)";
+ }
+ @Override
+ public boolean accept(File f) {
+ if(f.getName().toLowerCase().endsWith(".zip")) {
+ return true;
+ }
+ return false;
+ }
+ });
+// jfC.setMultiSelectionEnabled(true);//文件是否多选!参数为true或false
+ jfC.setFileSelectionMode(JFileChooser.FILES_ONLY);//设置文件的打开模式(只能选文件夹)
+ jfC.setDialogTitle("请选择要上传的文件夹");
+ int value = jfC.showOpenDialog(SwingFrame.this);
+ if(value == JFileChooser.APPROVE_OPTION) {
+ File dirFile = jfC.getSelectedFile();//返回选中的文件
+ textField.setText(dirFile.getAbsolutePath());
}
- });
-// jfC.setMultiSelectionEnabled(true);//文件是否多选!参数为true或false
- jfC.setFileSelectionMode(JFileChooser.FILES_ONLY);//设置文件的打开模式(只能选文件夹)
- jfC.setDialogTitle("请选择要上传的文件夹");
- int value = jfC.showOpenDialog(SwingFrame.this);
- if(value == JFileChooser.APPROVE_OPTION) {
- File dirFile = jfC.getSelectedFile();//返回选中的文件
- textField.setText(dirFile.getAbsolutePath());
+
+
+
+
+
+
+
+
}
});
startRestorePanel.add(button_5);
JLabel label_2 = new JLabel("数据库备份的格式为“zip”");
label_2.setFont(new Font("微软雅黑", Font.PLAIN, 15));
- label_2.setBounds(170, 120, 186, 18);
+ label_2.setBounds(131, 126, 186, 18);
startRestorePanel.add(label_2);
JButton button_6 = new JButton("开始还原");
- button_6.setFont(new Font("微软雅黑", Font.PLAIN, 15));
- button_6.setBounds(206, 186, 113, 35);
+ button_6.setForeground(Color.WHITE);
+ button_6.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+ button_6.setBackground(new Color(55, 205, 255));
+ button_6.setBounds(594, 90, 113, 35);
+ button_6.setBorderPainted(false);//去掉按钮的边框的设置
+ button_6.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ }
+ });
startRestorePanel.add(button_6);
- textField = new JTextField("");
+ textField = new JTextField();
textField.setFont(new Font("微软雅黑", Font.PLAIN, 15));
textField.setColumns(10);
- textField.setBounds(207, 91, 330, 24);
+ textField.setBounds(128, 97, 310, 24);
startRestorePanel.add(textField);
+ JLabel label_4 = new JLabel("返回");
+ label_4.setForeground(new Color(30, 144, 255));
+ label_4.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+ label_4.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ try{
+ tabbedPane.setSelectedComponent(backupsPanel);
+ }catch (Exception ex){
+ ex.printStackTrace();
+ }
+ }
+ });
+ label_4.setBounds(14, 13, 53, 31);
+ startRestorePanel.add(label_4);
+
JPanel textPanel = new JPanel();
textPanel.setLayout(null);
- textPanel.setBackground(new Color(220, 220, 220));
+ textPanel.setBackground(Color.WHITE);
tabbedPane.addTab("测试", null, textPanel, null);
+
JButton button_7 = new JButton("开始数据库服务");
button_7.setFont(new Font("微软雅黑", Font.PLAIN, 15));
button_7.setBounds(14, 13, 170, 35);
@@ -588,11 +724,13 @@ public class SwingFrame extends JFrame implements ActionListener {
JButton button_8 = new JButton("停止数据库服务");
button_8.setFont(new Font("微软雅黑", Font.PLAIN, 15));
button_8.setBounds(14, 61, 170, 24);
- button_8.addActionListener(e -> {
- try {
- new WindowsTomcatMysql().stopDbService();
- } catch (Exception exception) {
- exception.printStackTrace();
+ button_8.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ try {
+ new WindowsTomcatMysql().stopDbService();
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
}
});
textPanel.add(button_8);
@@ -600,11 +738,13 @@ public class SwingFrame extends JFrame implements ActionListener {
JButton button_9 = new JButton("开始中间件");
button_9.setFont(new Font("微软雅黑", Font.PLAIN, 15));
button_9.setBounds(14, 98, 170, 35);
- button_9.addActionListener(e -> {
- try {
- new WindowsTomcatMysql().startMwService();
- } catch (Exception exception) {
- exception.printStackTrace();
+ button_9.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ try {
+ new WindowsTomcatMysql().startMwService();
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
}
});
textPanel.add(button_9);
@@ -612,11 +752,13 @@ public class SwingFrame extends JFrame implements ActionListener {
JButton button_10 = new JButton("停止中间件");
button_10.setFont(new Font("微软雅黑", Font.PLAIN, 15));
button_10.setBounds(14, 153, 170, 35);
- button_10.addActionListener(e -> {
- try {
- new WindowsTomcatMysql().stopMwService();
- } catch (Exception exception) {
- exception.printStackTrace();
+ button_10.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ try {
+ new WindowsTomcatMysql().stopMwService();
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
}
});
textPanel.add(button_10);
@@ -658,34 +800,27 @@ public class SwingFrame extends JFrame implements ActionListener {
// }).start();
}
- @Override
- public void actionPerformed(ActionEvent e) {
- String buttonCommand = e.getActionCommand();
- if("打开服务管理器".equals(buttonCommand)) {
- try{
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String buttonCommand = e.getActionCommand();
+// if(buttonCommand.equals("打开服务管理器")) {
+// try{
// Runtime rt = Runtime.getRuntime();runBak
// Process p = rt.exec("cmd.exe /c compmgmt.msc");
- new WindowsTomcatMysql().openServer();
- }catch (Exception ex){
- ex.printStackTrace();
- }
- }else if("开始优化".equals(buttonCommand)) {
- try{
- tabbedPane.addTab("开始优化界面", null, startRepairPanel, null);
- tabbedPane.setSelectedComponent(startRepairPanel);
- new WindowsTomcatMysql().startDbService();
- new WindowsTomcatMysql().startDbService();
- }catch (Exception ex){
- ex.printStackTrace();
- }
- }else if("数据库备份".equals(buttonCommand)) {
- tabbedPane.addTab("数据库备份", null, startBackupPanel, null);
- tabbedPane.setSelectedComponent(startBackupPanel);
- }else if("数据库还原".equals(buttonCommand)) {
- tabbedPane.addTab("数据库还原", null, startRestorePanel, null);
- tabbedPane.setSelectedComponent(startRestorePanel);
- }else if("返回".equals(buttonCommand)) {
- tabbedPane.setSelectedComponent(backupsPanel);
+// new WindowsTomcatMysql().openServer();
+// }catch (Exception ex){
+// ex.printStackTrace();
+// }
+// }
+ if(buttonCommand.equals("开始优化")) {
+ try{
+ tabbedPane.addTab("开始优化界面", null, startRepairPanel, null);
+ tabbedPane.setSelectedComponent(startRepairPanel);
+// new WindowsTomcatMysql().startDbService();
+// new WindowsTomcatMysql().startDbService();
+ }catch (Exception ex){
+ ex.printStackTrace();
}
}
+ }
}
\ No newline at end of file