|
|
@ -1,6 +1,8 @@ |
|
|
|
package com.insigma.ui; |
|
|
|
|
|
|
|
import com.insigma.service.impl.WindowsTomcatMysql; |
|
|
|
import com.insigma.service.Computer; |
|
|
|
import com.insigma.service.Database; |
|
|
|
import com.insigma.service.Middleware; |
|
|
|
import lombok.SneakyThrows; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
@ -11,8 +13,6 @@ import java.io.File; |
|
|
|
import java.io.IOException; |
|
|
|
import java.net.URISyntaxException; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.awt.EventQueue; |
|
|
|
import javax.swing.JFrame; |
|
|
|
import javax.swing.JPanel; |
|
|
@ -45,6 +45,11 @@ import java.awt.Component; |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
public class SwingFrame extends JFrame implements ActionListener { |
|
|
|
|
|
|
|
private static Computer computer; |
|
|
|
private static Database database; |
|
|
|
private static Middleware middleware; |
|
|
|
|
|
|
|
private static final long serialVersionUID = 1L; |
|
|
|
private JPanel contentPane; |
|
|
|
private final int MIN_PROGRESS = 0; |
|
|
@ -62,7 +67,9 @@ public class SwingFrame extends JFrame implements ActionListener { |
|
|
|
/** |
|
|
|
* Launch the application. |
|
|
|
*/ |
|
|
|
public static void run() { |
|
|
|
public static void run(Computer c, Database d, Middleware m) { |
|
|
|
// 必须启动时,注入对象
|
|
|
|
setObjInfo(c, d, m); |
|
|
|
// try {
|
|
|
|
// for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
|
|
|
// if ("Nimbus".equals(info.getName())) {
|
|
|
@ -78,9 +85,7 @@ public class SwingFrame extends JFrame implements ActionListener { |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
EventQueue.invokeLater(new Runnable() { |
|
|
|
public void run() { |
|
|
|
try { |
|
|
|
EventQueue.invokeLater(() -> { |
|
|
|
SwingFrame frame = new SwingFrame(); |
|
|
|
frame.setTitle("系统工具"); //设置显示窗口标题
|
|
|
|
// frame.setSize(1600,400);//设置显示窗口大小
|
|
|
@ -89,18 +94,23 @@ public class SwingFrame extends JFrame implements ActionListener { |
|
|
|
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(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private static void setObjInfo(Computer c, Database d, Middleware m) { |
|
|
|
computer = c; |
|
|
|
database = d; |
|
|
|
middleware = m; |
|
|
|
log.info("【机器】启动应用:{}", computer); |
|
|
|
log.info("【库源】启动应用:{}", database); |
|
|
|
log.info("【容器】启动应用:{}", middleware); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Create the frame. |
|
|
|
* @throws IOException |
|
|
|
*/ |
|
|
|
public SwingFrame() throws IOException { |
|
|
|
public SwingFrame() { |
|
|
|
|
|
|
|
contentPane = new JPanel(); |
|
|
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
|
|
@ -178,11 +188,7 @@ public class SwingFrame extends JFrame implements ActionListener { |
|
|
|
lblNewLabel_3.addMouseListener(new MouseAdapter() { |
|
|
|
@Override |
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
try{ |
|
|
|
new WindowsTomcatMysql().openServer(); |
|
|
|
}catch (Exception ex){ |
|
|
|
ex.printStackTrace(); |
|
|
|
} |
|
|
|
computer.openServer(); |
|
|
|
} |
|
|
|
}); |
|
|
|
lblNewLabel_3.setBounds(128, 125, 140, 31); |
|
|
@ -233,18 +239,10 @@ 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(new ActionListener() { |
|
|
|
@SneakyThrows |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
new WindowsTomcatMysql().setDbSize(200000); |
|
|
|
|
|
|
|
btnNewButton_7.addActionListener(e -> { |
|
|
|
database.setDbSize(200000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new WindowsTomcatMysql().setMwSize(200000); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
middleware.setMwSize(200000); |
|
|
|
}); |
|
|
|
memoryPanel.add(btnNewButton_7); |
|
|
|
|
|
|
@ -258,14 +256,9 @@ public class SwingFrame extends JFrame implements ActionListener { |
|
|
|
@Override |
|
|
|
@SneakyThrows |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
new WindowsTomcatMysql().setDbSize(160000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new WindowsTomcatMysql().setMwSize(160000); |
|
|
|
|
|
|
|
database.setDbSize(160000); |
|
|
|
|
|
|
|
middleware.setMwSize(160000); |
|
|
|
} |
|
|
|
}); |
|
|
|
memoryPanel.add(button_1); |
|
|
@ -280,14 +273,9 @@ public class SwingFrame extends JFrame implements ActionListener { |
|
|
|
@Override |
|
|
|
@SneakyThrows |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
new WindowsTomcatMysql().setDbSize(80000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new WindowsTomcatMysql().setMwSize(80000); |
|
|
|
|
|
|
|
database.setDbSize(80000); |
|
|
|
|
|
|
|
middleware.setMwSize(80000); |
|
|
|
} |
|
|
|
}); |
|
|
|
memoryPanel.add(button_2); |
|
|
@ -302,14 +290,9 @@ public class SwingFrame extends JFrame implements ActionListener { |
|
|
|
@Override |
|
|
|
@SneakyThrows |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
new WindowsTomcatMysql().setDbSize(40000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new WindowsTomcatMysql().setMwSize(40000); |
|
|
|
|
|
|
|
database.setDbSize(40000); |
|
|
|
|
|
|
|
middleware.setMwSize(40000); |
|
|
|
} |
|
|
|
}); |
|
|
|
memoryPanel.add(button_3); |
|
|
@ -320,20 +303,10 @@ public class SwingFrame extends JFrame implements ActionListener { |
|
|
|
btnNewButton_1.setBackground(new Color(55, 205, 255)); |
|
|
|
btnNewButton_1.setBorderPainted(false);//去掉按钮的边框的设置
|
|
|
|
btnNewButton_1.setBounds(566, 472, 113, 40); |
|
|
|
btnNewButton_1.addActionListener(new ActionListener() { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
btnNewButton_1.addActionListener(e -> { |
|
|
|
//暂定保存内容
|
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memoryPanel.add(btnNewButton_1); |
|
|
|
|
|
|
|
backupsPanel = new JPanel();//数据库备份、还原面板
|
|
|
@ -741,7 +714,7 @@ public class SwingFrame extends JFrame implements ActionListener { |
|
|
|
tabbedPane.addTab("测试", null, textPanel, null); |
|
|
|
|
|
|
|
// 代码可以注释掉,我这边开发放开
|
|
|
|
Test.runTest(textPanel); |
|
|
|
Test.runTest(textPanel, computer, database, middleware); |
|
|
|
// new Timer(500, new ActionListener() {
|
|
|
|
// @Override
|
|
|
|
// public void actionPerformed(ActionEvent e) {
|
|
|
@ -762,17 +735,17 @@ public class SwingFrame extends JFrame implements ActionListener { |
|
|
|
// try{
|
|
|
|
// Runtime rt = Runtime.getRuntime();runBak
|
|
|
|
// Process p = rt.exec("cmd.exe /c compmgmt.msc");
|
|
|
|
// new WindowsTomcatMysql().openServer();
|
|
|
|
// computer.openServer();
|
|
|
|
// }catch (Exception ex){
|
|
|
|
// ex.printStackTrace();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
if(buttonCommand.equals("开始优化")) { |
|
|
|
if("开始优化".equals(buttonCommand)) { |
|
|
|
try{ |
|
|
|
tabbedPane.addTab("开始优化界面", null, startRepairPanel, null); |
|
|
|
tabbedPane.setSelectedComponent(startRepairPanel); |
|
|
|
// new WindowsTomcatMysql().startDbService();
|
|
|
|
// new WindowsTomcatMysql().startDbService();
|
|
|
|
// database.startDbService();
|
|
|
|
// database.startDbService();
|
|
|
|
}catch (Exception ex){ |
|
|
|
ex.printStackTrace(); |
|
|
|
} |
|
|
|