⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reportpanel.java~43~

📁 银行信用评估系统
💻 JAVA~43~
字号:
package management;

import java.awt.*;
import javax.swing.*;
import java.sql.*;
import com.borland.dx.dataset.*;
import com.borland.jbcl.layout.*;
import com.borland.dx.sql.dataset.*;
import java.awt.event.*;


/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class reportPanel extends JPanel {
  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();
  JPasswordField jPasswordField1 = new JPasswordField();
  JPasswordField jPasswordField2 = new JPasswordField();
  JLabel jLabel3 = new JLabel();
  JPasswordField jPasswordField3 = new JPasswordField();
  JLabel jLabel4 = new JLabel();
  JPasswordField jPasswordField4 = new JPasswordField();
  JButton jButton1 = new JButton();
  JButton jButton2 = new JButton();
  JButton jButton3 = new JButton();
  JLabel jLabel6 = new JLabel();
    JLabel jLabel7 = new JLabel();
  Database database1 = new Database();
  QueryDataSet queryDataSet1 = new QueryDataSet();
  QueryResolver queryResolver1 = new QueryResolver();

  PreparedStatement pstmt;
  Connection con;
  String query;
  ResultSet rs;
  String str;
  String strx;
  String ip;
  JLabel jLabel8 = new JLabel();
  GridBagLayout gridBagLayout1 = new GridBagLayout();
  JLabel jLabel9 = new JLabel();
  public reportPanel() {
    try {
      jbInit();
    }
    catch(Exception ex) {
      ex.printStackTrace();
    }
  }
  public reportPanel(String strx1) {
  strx=strx1;
    try {
    jbInit();
  }
  catch(Exception ex) {
    ex.printStackTrace();
  }
}
public reportPanel(String strx1,String strx2) {
 strx=strx1;
 ip=strx2;
   try {
   jbInit();
 }
 catch(Exception ex) {
   ex.printStackTrace();
 }
}


  void jbInit() throws Exception {
    jLabel1.setFont(new java.awt.Font("Dialog", 1, 22));    jLabel1.setForeground(SystemColor.activeCaption);
    jLabel1.setText(" 旧 密 码:");
    this.setLayout(gridBagLayout1);
    this.setBackground(new Color(217, 230, 236));
    this.setDebugGraphicsOptions(0);
    this.setMaximumSize(new Dimension(2147483647, 2147483647));
    this.setOpaque(true);
    jLabel2.setFont(new java.awt.Font("Dialog", 1, 22));    jLabel2.setForeground(SystemColor.activeCaption);
    jLabel2.setText("确认旧密码:");
    jPasswordField1.setText("");
    jPasswordField2.setText("");
    jLabel3.setFont(new java.awt.Font("Dialog", 1, 22));    jLabel3.setForeground(SystemColor.activeCaption);
    jLabel3.setText("新密码:");
    jPasswordField3.setText("");
    jLabel4.setFont(new java.awt.Font("Dialog", 1, 22));    jLabel4.setForeground(SystemColor.activeCaption);
    jLabel4.setText("确认新密码:");
    jPasswordField4.setSelectionStart(15);
    jPasswordField4.setText("");
    jButton1.setBackground(new Color(151, 164, 203));    jButton1.setFont(new java.awt.Font("Dialog", 1, 18));    jButton1.setAlignmentY((float) 0.5);
    jButton1.setText("修改");
    jButton1.addActionListener(new reportPanel_jButton1_actionAdapter(this));
    jButton2.setBackground(new Color(151, 164, 203));    jButton2.setFont(new java.awt.Font("Dialog", 1, 15));    jButton2.setText("重置旧密码");
    jButton2.addActionListener(new reportPanel_jButton2_actionAdapter(this));
    jButton3.setBackground(new Color(151, 164, 203));    jButton3.setFont(new java.awt.Font("Dialog", 1, 15));    jButton3.setText("重置新密码");
    jButton3.addActionListener(new reportPanel_jButton3_actionAdapter(this));
    jLabel6.setFont(new java.awt.Font("Dialog", 1, 22));    jLabel6.setForeground(SystemColor.activeCaption);
    jLabel6.setText("");
    jLabel7.setFont(new java.awt.Font("Dialog", 1, 22));    jLabel7.setForeground(SystemColor.activeCaption);
    jLabel7.setText("操作:");
    jLabel8.setBackground(Color.red);
    jLabel8.setFont(new java.awt.Font("Dialog", 1, 22));
    jLabel8.setForeground(Color.red);
    jLabel9.setFont(new java.awt.Font("Dialog", 1, 44));    jLabel9.setForeground(SystemColor.activeCaption);    jLabel9.setText("       学 生 密 码 管 理");
    this.add(jLabel4,   new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(32, 19, 0, 0), 12, -5));
    this.add(jLabel2,   new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(29, 19, 0, 0), 9, -11));
    this.add(jPasswordField2,   new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(26, 20, 0, 0), 209, 3));
    this.add(jLabel1,   new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(25, 12, 0, 31), 12, -7));
    this.add(jLabel3,   new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(34, 18, 0, 28), 31, -9));
    this.add(jPasswordField3,   new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(32, 21, 0, 0), 208, 5));
    this.add(jPasswordField1,   new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(22, 19, 0, 0), 210, 4));
    this.add(jPasswordField4,   new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(33, 22, 0, 0), 207, 5));
    this.add(jButton3,   new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0
            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(33, 19, 0, 11), 6, 2));
    this.add(jButton2,   new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0
            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(26, 18, 0, 11), 7, 1));
    this.add(jLabel7,   new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(28, 18, 6, 18), 64, -3));
    this.add(jButton1,   new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0
            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(31, 45, 0, 91), 24, -4));
    this.add(jLabel8,   new GridBagConstraints(1, 7, 2, 1, 0.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(34, 14, 32, 29), 315, 57));
    this.add(jLabel6,   new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(29, 37, 32, 0), 14, 33));
    this.add(jLabel9,    new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0
            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 279, 0));

    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    String url = "jdbc:microsoft:sqlserver://"+ip+":1433;DatabaseName=student";
    String username= "sa";
    String password= "lomf8244";
    con = DriverManager.getConnection(url,username,password);

    jLabel6.setText("修改结果:");

  }

  void jButton1_actionPerformed(ActionEvent e) {
    String str1=null;
    String str2=null;
    String str3=null;
    String str4=null;

    for(int i=0;i<jPasswordField1.getPassword().length;i++)
      str1+=jPasswordField1.getPassword()[i];
      str1=str1.substring(4);
    for(int i=0;i<jPasswordField2.getPassword().length;i++)
      str2+=jPasswordField2.getPassword()[i];
      str2=str2.substring(4);
    for(int i=0;i<jPasswordField3.getPassword().length;i++)
      str3+=jPasswordField3.getPassword()[i];
      str3=str3.substring(4);
    for(int i=0;i<jPasswordField4.getPassword().length;i++)
      str4+=jPasswordField4.getPassword()[i];
      str4=str4.substring(4);
    if(str1.equals(str2))
    {
       try{
         query = "select * from usercheck where STUDENTNO=?";
         pstmt = con.prepareStatement(query);
         pstmt.setString(1,strx);
          rs=pstmt.executeQuery();
           if(rs.next()){
              str = rs.getString("PASSWORDS");

              if(str1.equals(str))
               {
                  if(str3.equals(str4))
                  {
                    //更新密码;
                    jLabel8.setText("更新密码成功");
                    query = "update usercheck set PASSWORDS="+ "\'"+str3+ "\'"+"where STUDENTNO=?";
                    pstmt = con.prepareStatement(query);
                    pstmt.setString(1,strx);
                   rs=pstmt.executeQuery();

                  }
                 else
                  { jLabel8.setText("新密码不匹配,请重新输入");
                   jPasswordField3.setText("");
                   jPasswordField4.setText("");
                  }
                }

              else
              {
                  jLabel8.setText("旧密码输入错误,请重新输入");
                   jPasswordField1.setText("");
                   jPasswordField2.setText("");
              }
           }
           else
             jLabel8.setText("没有匹配项!");
       }
       catch(Exception ep)
       {
       }
    }
    else
    {
     jLabel8.setText("旧密码不匹配,请重新输入");
     jPasswordField1.setText("");
     jPasswordField2.setText("");
     }
 }

  void jButton2_actionPerformed(ActionEvent e) {
    jPasswordField1.setText("");
     jPasswordField2.setText("");
  }

  void jButton3_actionPerformed(ActionEvent e) {
    jPasswordField3.setText("");
    jPasswordField4.setText("");
  }
}

class reportPanel_jButton1_actionAdapter implements java.awt.event.ActionListener {
  reportPanel adaptee;

  reportPanel_jButton1_actionAdapter(reportPanel adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton1_actionPerformed(e);
  }
}

class reportPanel_jButton2_actionAdapter implements java.awt.event.ActionListener {
  reportPanel adaptee;

  reportPanel_jButton2_actionAdapter(reportPanel adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton2_actionPerformed(e);
  }
}

class reportPanel_jButton3_actionAdapter implements java.awt.event.ActionListener {
  reportPanel adaptee;

  reportPanel_jButton3_actionAdapter(reportPanel adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton3_actionPerformed(e);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -