diff --git a/src/main/java/com/insigma/ui/SwingFrame.java b/src/main/java/com/insigma/ui/SwingFrame.java new file mode 100644 index 0000000..60d6f01 --- /dev/null +++ b/src/main/java/com/insigma/ui/SwingFrame.java @@ -0,0 +1,572 @@ +package com.qggwy; + +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.JButton; +import java.awt.Panel; +import javax.swing.JTabbedPane; +import java.awt.Font; + +import javax.swing.JTextField; +import java.awt.Color; +import java.awt.Desktop; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.UIManager; +import javax.swing.ImageIcon; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.awt.event.ActionEvent; +import javax.swing.JCheckBox; +import javax.swing.JProgressBar; +import javax.swing.Timer; +import javax.swing.JTextPane; +import java.awt.Component; + +public class SwingFrame extends JFrame implements ActionListener { + + /** + * + */ + private static final long serialVersionUID = 1L; + private JPanel contentPane; + private JTextField textField; + private JTextField textField_1; + private JTextField textField_2; + private JTextField textField_3; + private JTextField textField_4; + private final int MIN_PROGRESS = 0; + private final int MAX_PROGRESS = 100; + private int currentProgress = MIN_PROGRESS; + private JTextField textField_5; + private JLabel lblNewLabel_6; + + + /** + * Launch the application. + */ + public static void main(String[] args) { + 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(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, 773, 459); + frame.setVisible(true); + java.net.URL imgURL =SwingFrame.class.getResource("favicon.jpg"); + ImageIcon arrowIcon = null; + if (imgURL != null) { + arrowIcon = new ImageIcon(imgURL); + frame.setIconImage(arrowIcon.getImage()); + } else { + JOptionPane.showMessageDialog(frame, "Icon image not found."); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + * @throws IOException + */ + public SwingFrame() throws IOException { + + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(null); + + JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.LEFT); + tabbedPane.setBounds(5, 5, 745, 402); + tabbedPane.setBackground(Color.WHITE); + tabbedPane.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + contentPane.add(tabbedPane); + + 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)); + tabbedPane.addTab("调整内存", null, memoryPanel, null); + memoryPanel.setLayout(null); + + JLabel lblNewLabel = new JLabel("调整内存"); + lblNewLabel.setBounds(60, 31, 125, 34); + lblNewLabel.setForeground(Color.RED); + lblNewLabel.setFont(new Font("微软雅黑", Font.PLAIN, 30)); + memoryPanel.add(lblNewLabel); + + JLabel lblNewLabel_1 = new JLabel("根据具体系统运行可设置应用内容、数据库内容的大小。"); + lblNewLabel_1.setBounds(60, 75, 375, 18); + lblNewLabel_1.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + memoryPanel.add(lblNewLabel_1); + + JSeparator separator = new JSeparator(); + separator.setBackground(Color.LIGHT_GRAY); + separator.setBounds(60, 106, 531, 5); + memoryPanel.add(separator); + + JLabel lblNewLabel_2 = new JLabel("应用内存"); + lblNewLabel_2.setBounds(60, 124, 80, 18); + lblNewLabel_2.setFont(new Font("微软雅黑", Font.PLAIN, 20)); + memoryPanel.add(lblNewLabel_2); + + JLabel lblNewLabel_3 = new JLabel("非堆区初始内存分配大小"); + lblNewLabel_3.setBackground(new Color(221, 160, 221)); + lblNewLabel_3.setBounds(82, 165, 175, 18); + lblNewLabel_3.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + memoryPanel.add(lblNewLabel_3); + + JLabel label = new JLabel("堆区最大内存分配上限"); + label.setBounds(82, 196, 156, 18); + label.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + memoryPanel.add(label); + + JLabel label_1 = new JLabel("初始内存分配大小"); + label_1.setBounds(82, 227, 156, 18); + label_1.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + memoryPanel.add(label_1); + + JLabel label_2 = new JLabel("最大内存分配上限"); + label_2.setBounds(82, 258, 156, 18); + label_2.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + memoryPanel.add(label_2); + + textField = new JTextField(); + textField.setBounds(255, 163, 86, 24); + memoryPanel.add(textField); + textField.setColumns(10); + + textField_1 = new JTextField(); + textField_1.setBounds(255, 196, 86, 24); + textField_1.setColumns(10); + memoryPanel.add(textField_1); + + textField_2 = new JTextField(); + textField_2.setBounds(255, 227, 86, 24); + textField_2.setColumns(10); + memoryPanel.add(textField_2); + + textField_3 = new JTextField(); + textField_3.setBounds(255, 256, 86, 24); + textField_3.setColumns(10); + memoryPanel.add(textField_3); + + JLabel lblNewLabel_4 = new JLabel("最大可设置到1024MB"); + lblNewLabel_4.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + lblNewLabel_4.setBounds(355, 166, 163, 18); + memoryPanel.add(lblNewLabel_4); + + JLabel label_3 = new JLabel("数据库内存"); + label_3.setFont(new Font("微软雅黑", Font.PLAIN, 20)); + label_3.setBounds(60, 307, 100, 24); + memoryPanel.add(label_3); + + JLabel label_4 = new JLabel("数据库内存大小"); + label_4.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + label_4.setBounds(82, 344, 156, 18); + memoryPanel.add(label_4); + + textField_4 = new JTextField(); + textField_4.setColumns(10); + textField_4.setBounds(255, 342, 86, 24); + memoryPanel.add(textField_4); + + + JButton btnNewButton_1 = new JButton("保存"); + 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)); + btnNewButton_1.setBounds(500, 344, 113, 40); + memoryPanel.add(btnNewButton_1); + + + JPanel repairPanel = new JPanel();//数据修复面板 + repairPanel.setForeground(Color.GRAY); + repairPanel.setBackground(new Color(220, 220, 220)); + 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.setFont(new Font("微软雅黑", Font.PLAIN, 30)); + repairPanel.add(label_5); + + JButton btnNewButton = new JButton("开始修复"); + btnNewButton.setBounds(504, 42, 113, 40); + repairPanel.add(btnNewButton); + + JLabel label_6 = new JLabel("通过数据清洗等操作可以有效解决系统功能异常问题"); + label_6.setBounds(42, 76, 375, 18); + label_6.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + repairPanel.add(label_6); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBackground(Color.LIGHT_GRAY); + separator_1.setBounds(27, 100, 590, 5); + repairPanel.add(separator_1); + + JCheckBox chckbxNewCheckBox = new JCheckBox("修复数据库数据"); + chckbxNewCheckBox.setBackground(new Color(220, 220, 220)); + chckbxNewCheckBox.setBounds(53, 130, 162, 27); + chckbxNewCheckBox.setFont(new Font("微软雅黑", Font.PLAIN, 18)); + repairPanel.add(chckbxNewCheckBox); + + JLabel lblNewLabel_5 = new JLabel("机构信息管理、人员信息管理、数据校核、信息系统查询等。"); + lblNewLabel_5.setBounds(77, 166, 405, 18); + lblNewLabel_5.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + repairPanel.add(lblNewLabel_5); + + JCheckBox checkBox = new JCheckBox("修复系统管理数据"); + checkBox.setBackground(new Color(220, 220, 220)); + checkBox.setBounds(53, 193, 173, 27); + checkBox.setFont(new Font("微软雅黑", Font.PLAIN, 18)); + repairPanel.add(checkBox); + + JLabel label_7 = new JLabel("角色管理、用户管理、日志管理、系统参数配置等。"); + label_7.setBounds(77, 229, 345, 18); + label_7.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + repairPanel.add(label_7); + + JCheckBox checkBox_1 = new JCheckBox("修复统计专用信息管理数据"); + checkBox_1.setBackground(new Color(220, 220, 220)); + checkBox_1.setBounds(53, 256, 253, 27); + checkBox_1.setFont(new Font("微软雅黑", Font.PLAIN, 18)); + repairPanel.add(checkBox_1); + + JLabel label_8 = new JLabel("信息表、校核、使用情况、人员对比等。"); + label_8.setBounds(72, 290, 270, 18); + label_8.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + repairPanel.add(label_8); + + JCheckBox checkBox_2 = new JCheckBox("修复年报统计数据"); + checkBox_2.setBackground(new Color(220, 220, 220)); + checkBox_2.setBounds(53, 331, 253, 27); + checkBox_2.setFont(new Font("微软雅黑", Font.PLAIN, 18)); + repairPanel.add(checkBox_2); + + JLabel label_9 = new JLabel("统计报表、校核、报表说明等。"); + label_9.setFont(new Font("微软雅黑", Font.PLAIN, 15)); + label_9.setBounds(72, 366, 270, 18); + repairPanel.add(label_9); + + Panel backupsPanel = new Panel();//数据库备份面板 + backupsPanel.setBackground(new Color(220, 220, 220)); + tabbedPane.addTab("数据库备份", null, backupsPanel, null); + backupsPanel.setLayout(null); + + JLabel lblNewLabel_12 = new JLabel("数据库备份"); + lblNewLabel_12.setBounds(32, 13, 114, 28); + lblNewLabel_12.setFont(new Font("微软雅黑", Font.PLAIN, 20)); + backupsPanel.add(lblNewLabel_12); + + JLabel label_10 = new JLabel("数据库还原"); + label_10.setBounds(459, 13, 105, 28); + label_10.setFont(new Font("微软雅黑", Font.PLAIN, 20)); + backupsPanel.add(label_10); + + String strMsg1 = "当系统因突发情况无法正常启动时,可以进行数据备份,确保因系统异常情况导致数据丢失。"; + String strMsg = "
" + strMsg1 + "