logo资料库

16.中医腧穴教学系统 (源码).docx

第1页 / 共96页
第2页 / 共96页
第3页 / 共96页
第4页 / 共96页
第5页 / 共96页
第6页 / 共96页
第7页 / 共96页
第8页 / 共96页
资料共96页,剩余部分请下载后查看
ChangPasswords: package saber; import java.awt.BorderLayout; import java.awt.Component; import java.awt.EventQueue; import java.awt.Color; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JMenuBar; import javax.swing.JOptionPane; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JButton; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.Font; import java.awt.Toolkit; import javax.swing.ImageIcon; public class ChangPasswords extends JFrame { protected static final Component JPanel = null; private JPanel contentPane; private JTextField textField; private JTextField textField_1; private String dataString; private String idString; private String pwString; private JTextField textField_2; /** * Launch the application. */ /*public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { }); }*/ public void run() {
try { ChangPasswords frame = new ChangPasswords(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } /** * Create the frame. */ public ChangPasswords() { setIconImage(Toolkit.getDefaultToolkit().getImage(ChangPasswords.class.getResource("/pict ure/1\u65E7\u5BC6\u7801.png"))); setTitle("\u4FEE\u6539\u5BC6\u7801"); addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { idString = ""; pwString = Send.pw; if (Send.id == 0) { idString = Send.tID; } else if (Send.id == 1) { idString = Send.sID; } else { idString = ""; } } }); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 612, 392); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblNewLabel = new JLabel("\u65E7\u5BC6\u7801\uFF1A"); lblNewLabel.setFont(new Font("黑体", Font.PLAIN, 16)); lblNewLabel.setBounds(111, 86, 105, 15); contentPane.add(lblNewLabel); JLabel lblNewLabel_1 = new JLabel("\u65B0\u5BC6\u7801\uFF1A"); lblNewLabel_1.setFont(new Font("黑体", Font.PLAIN, 16)); lblNewLabel_1.setBounds(111, 143, 105, 15);
contentPane.add(lblNewLabel_1); textField = new JTextField(); textField.setBounds(226, 84, 237, 21); contentPane.add(textField); textField.setColumns(10); textField_1 = new JTextField(); textField_1.setBounds(226, 141, 237, 21); contentPane.add(textField_1); textField_1.setColumns(10); JButton btnNewButton = new JButton("\u767B\u5F55"); btnNewButton.setIcon(new ImageIcon(ChangPasswords.class.getResource("/picture/1\u786E\u5B9A.png"))); btnNewButton.setFont(new Font("黑体", Font.PLAIN, 16)); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (textField.getText().equals("") || textField_1.getText().equals("")) { JOptionPane.showMessageDialog(JPanel, " 请 您 完 善 信 息", " 错 误 !", JOptionPane.WARNING_MESSAGE); } else if (!textField.getText().equals(pwString)) { JOptionPane.showMessageDialog(JPanel, "原密码错误,请重新填写", " 错误!", JOptionPane.WARNING_MESSAGE); textField.setText(""); textField_1.setText(""); textField_2.setText(""); } else if (textField.getText().equals(textField_1.getText())) { JOptionPane.showMessageDialog(JPanel, "新旧密码相同,请重新填写 新密码", "错误!", JOptionPane.WARNING_MESSAGE); textField_1.setText(""); textField_2.setText(""); }else if (!textField_1.getText().equals(textField_2.getText())) { JOptionPane.showMessageDialog(JPanel, "两次输入的密码不同,请重 新填写新密码", "错误!", JOptionPane.WARNING_MESSAGE); textField_1.setText(""); textField_2.setText(""); } else { SqlseverOpetion sqlseverOpetion = new SqlseverOpetion(); if (Send.id == 0) { sqlseverOpetion.updatesql("update teacher set rcode = '" + textField_1.getText() + "' where RID = '" + idString + "'");
textField_1.getText() } else if (Send.id == 1) { sqlseverOpetion.updatesql("update student set scode = '" + + "' where SID = '" + idString + "'"); } else { idString = ""; } JOptionPane.showMessageDialog(JPanel, " 修 改 成 功 ", " 错 误 ! ", JOptionPane.WARNING_MESSAGE); } } }); btnNewButton.setBounds(149, 277, 97, 23); contentPane.add(btnNewButton); JLabel lblNewLabel_2 = new JLabel("\u91CD\u590D\u65B0\u5BC6\u7801\uFF1A"); lblNewLabel_2.setFont(new Font("黑体", Font.PLAIN, 16)); lblNewLabel_2.setBounds(95, 200, 112, 15); contentPane.add(lblNewLabel_2); textField_2 = new JTextField(); textField_2.setBounds(226, 198, 237, 21); contentPane.add(textField_2); textField_2.setColumns(10); JButton btnNewButton_1 = new JButton("\u91CD\u7F6E"); btnNewButton_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textField.setText(""); textField_1.setText(""); textField_2.setText(""); } }); btnNewButton_1.setIcon(new ImageIcon(ChangPasswords.class.getResource("/picture/1\u91CD\u7F6E.png"))); btnNewButton_1.setFont(new Font("黑体", Font.PLAIN, 16)); btnNewButton_1.setBounds(323, 277, 97, 23); contentPane.add(btnNewButton_1); } }
Login: package saber; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import javax.swing.GroupLayout; import javax.swing.GroupLayout.Alignment; import javax.swing.JLabel; import javax.swing.JOptionPane; import java.awt.Font; import javax.swing.ImageIcon; import javax.swing.JTextField; import javax.swing.LayoutStyle.ComponentPlacement; import javax.swing.JComboBox; import javax.swing.DefaultComboBoxModel; import javax.swing.JButton; import java.awt.event.ActionListener; import java.sql.Connection; import java.sql.DriverManager; import java.awt.event.ActionEvent; import java.awt.Color; import java.awt.Component; import java.sql.*; import java.awt.Toolkit; public class Login extends JFrame { protected static final Component JPanel = null; private JPanel contentPane; private JTextField textField; private JTextField textField_1; private static Login frame_now; /** * Launch the application.
*/ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Login frame = new Login(); frame_now=frame; frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public Login() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(false); setIconImage(Toolkit.getDefaultToolkit().getImage(Login.class.getResource("/picture/1\u767 B\u5F55.png"))); setBackground(Color.WHITE); setTitle("\u767B\u5F55\u754C\u9762"); setBounds(100, 100, 575, 407); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); JLabel lblNewLabel = new JLabel("\u4E2D\u533B\u8167\u7A74\u6559\u5B66\u7CFB\u7EDF"); lblNewLabel.setIcon(new ImageIcon(Login.class.getResource("/picture/\u4E2D\u533B\u4F53\u8D28\u8FA8\u8BC6.png"))) ; lblNewLabel.setFont(new Font("微软雅黑", Font.BOLD, 40)); textField = new JTextField(); textField.setColumns(10); textField_1 = new JTextField(); textField_1.setColumns(10);
JLabel lblNewLabel_1 = new JLabel("\u7528\u6237\u540D\uFF1A"); lblNewLabel_1.setFont(new Font("黑体", Font.PLAIN, 16)); JLabel lblNewLabel_2 = new JLabel("\u5BC6 \u7801\uFF1A"); lblNewLabel_2.setFont(new Font("黑体", Font.PLAIN, 16)); JComboBox comboBox = new JComboBox(); comboBox.setModel(new DefaultComboBoxModel(new String[] { "\u6559\u5E08", "\u5B66\u751F" })); JLabel lblNewLabel_3 = new JLabel("\u7528\u6237\u7C7B\u578B\uFF1A"); lblNewLabel_3.setFont(new Font("黑体", Font.PLAIN, 16)); JButton btnNewButton = new JButton("\u767B\u5F55"); btnNewButton.setIcon(new ImageIcon(Login.class.getResource("/picture/2\u767B\u5F55.png"))); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if ("学生".equals(comboBox.getSelectedItem())) { SqlseverOpetion sqlseverOpetion = new SqlseverOpetion(); String idString = textField.getText(); // System.out.println(idString); String pwString = textField_1.getText(); // System.out.println(pwString); String[][] studentip = sqlseverOpetion.getstudentip(); boolean flag = false; w: for (int i = 0; i < studentip.length; i++) { if (studentip[i][0].equals(idString)) { for (int j = 0; j < studentip.length; j++) { if (studentip[j][1].equals(pwString)) { flag = true; break w; } } } } // 快捷账号,测试用 if (idString.equals("1") && pwString.equals("1")) { flag = true; } if (flag == true) { Send.sID = idString; Send.pw = pwString; Student_Main student_Main = new Student_Main();
frame_now.setVisible(false); student_Main.run(); } } else if ("教师".equals(comboBox.getSelectedItem())) { SqlseverOpetion sqlseverOpetion = new SqlseverOpetion(); String idString = textField.getText(); // System.out.println(idString); String pwString = textField_1.getText(); // System.out.println(pwString); String[][] teacherip = sqlseverOpetion.getteacherip(); boolean flag = false; w: for (int i = 0; i < teacherip.length; i++) { if (teacherip[i][0].equals(idString)) { for (int j = 0; j < teacherip.length; j++) { if (teacherip[j][1].equals(pwString)) { flag = true; break w; } } } } // 快捷账号,测试用 if (idString.equals("1") && pwString.equals("1")) { flag = true; } if (flag == true) { Send.tID = idString; Send.pw = pwString; Teacher_MainFrame Teacher_MainFrame(); teacher_MainFrame = new frame_now.setVisible(false); teacher_MainFrame.run(); SqlseverOpetion sqlseverOpetion_1 = new SqlseverOpetion(); Send.tname=sqlseverOpetion_1.getdata_String("select RNAME from teacher where RID = '"+idString+"' ")[0][0]; } }else { JOptionPane.showMessageDialog(JPanel, "账号或密码错误,请重试", " 错误!", JOptionPane.WARNING_MESSAGE); textField.setText(""); textField_1.setText(""); } } });
分享到:
收藏