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

📄 workflow_loginmain.java

📁 用java实现的工作流
💻 JAVA
字号:
package treedoc;

/**软件登录界面类,用户登录控制方法
 */

/**
 * 名称       : WORKFLOW_LOGIN
 * 描述       : WWW.FANGFA.NET 工作流管理系统--主窗口登录窗体类
 * 版权信息   : Copyright (c) 2004 COMSCI
 * @作者      : COMSCI Sichuan Fangfa Digital
 * @版本      : 0.9 builder 2004091910
 * @日期      : 2004/09/19
 */

import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import javax.swing.border.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import java.util.Properties;

public class WorkFlow_LoginMain
    extends JPanel {

  JPanel jPanel1 = new JPanel();
  JLabel jLabel1 = new JLabel();
  XYLayout xYLayout2 = new XYLayout();
  TitledBorder titledBorder1;
  JLabel jLabel2 = new JLabel();
  JTextField jTextField1 = new JTextField();
  JLabel jLabel3 = new JLabel();
  JPasswordField jPasswordField1 = new JPasswordField();
  JButton jButton1 = new JButton();
  JButton jButton2 = new JButton();
  JLabel jLabel4 = new JLabel();
  BorderLayout borderLayout1 = new BorderLayout();
  static JFrame jf;
  JLabel jLabel5 = new JLabel();

  workflow_StepMain smn;

  //构造方法

  public WorkFlow_LoginMain() {
    try {
      jbInit();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
  }

//JB GUI界面INIT类

  private void jbInit() throws Exception {

    smn = new workflow_StepMain("");

    jPanel1.setLayout(xYLayout2);
    jLabel1.setFont(new java.awt.Font("幼圆", 1, 18));
    jLabel1.setBorder(null);
    jLabel1.setToolTipText("");
    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel1.setHorizontalTextPosition(SwingConstants.CENTER);
    jLabel1.setText("工作流管理平台");
    jLabel2.setFont(new java.awt.Font("Dialog", 1, 11));
    jLabel2.setBorder(BorderFactory.createEtchedBorder());
    jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel2.setText("用户名");
    jLabel3.setFont(new java.awt.Font("Dialog", 1, 11));
    jLabel3.setBorder(BorderFactory.createEtchedBorder());
    jLabel3.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel3.setText("密码");
    jTextField1.setText("");
    jPasswordField1.setText("");
    jButton1.setText("登录");
    jButton1.addActionListener(new WorkFlow_LoginMain_jButton1_actionAdapter(this));
    jButton2.setText("关闭");
    jButton2.addActionListener(new WorkFlow_LoginMain_jButton2_actionAdapter(this));
    jLabel4.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel4.setHorizontalTextPosition(SwingConstants.CENTER);
    jLabel4.setText("工作流管理系统 v1.0 四川方法数码科技"); //登录界面上的版权信息

    jPanel1.setBorder(BorderFactory.createRaisedBevelBorder());
    this.setLayout(borderLayout1);
    this.setEnabled(true);
    this.setBorder(null);

///////////////////////外部资源文件///////////////////////////////
    String icon = "";

    try {

      FileInputStream Resfile = new FileInputStream("config.properties");
      Properties props = new Properties();
      props.load(Resfile);
      icon = props.getProperty("icon1");

    }
    catch (IOException e) {
      System.out.println(e);
    }

    ///////////////////////////////////////////////////////////////////

    ImageIcon icon2 = new ImageIcon(icon);

    jLabel5.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel5.setHorizontalTextPosition(SwingConstants.CENTER);
    jLabel5.setIcon(icon2);
    jPanel1.add(jLabel4, new XYConstraints(21, 189, 289, 26));
    jPanel1.add(jButton2, new XYConstraints(198, 144, -1, -1));
    jPanel1.add(jButton1, new XYConstraints(68, 144, -1, -1));
    jPanel1.add(jLabel5, new XYConstraints(12, 8, 139, 53));
    jPanel1.add(jLabel1, new XYConstraints(146, 16, 151, 32));
    jPanel1.add(jPasswordField1, new XYConstraints(118, 106, 176, 26));
    jPanel1.add(jLabel2, new XYConstraints(36, 76, 72, 25));
    jPanel1.add(jTextField1, new XYConstraints(118, 76, 176, 26));
    jPanel1.add(jLabel3, new XYConstraints(36, 108, 72, 25));
    this.add(jPanel1, BorderLayout.CENTER);

  }

//BUTTON1的ACTION方法,用于进行登录检查.........

  void jButton1_actionPerformed(ActionEvent e) {

    char[] pa = this.jPasswordField1.getPassword(); //取密码字符数组
    String Dep_name = smn.get_department_name1(smn.get_department(this.
        jTextField1.getText()));
    // 取部门信息,用于主窗口显示
    String PAK = ""; //将字符数组转换为字符串的变量

    if (this.checkuser(this.jTextField1.getText(), PAK.copyValueOf(pa))) {
      jf.dispose();
      workflow_main wm = new workflow_main(this.jTextField1.getText(), Dep_name);
      wm.main(null);

    }
    else {
      JOptionPane.showMessageDialog(null, "用户信息不正确...");
    }

  }

  void jButton2_actionPerformed(ActionEvent e) {

    jf.dispose();
    System.exit(0);

  }

// 用户是否合法检测方法

  private boolean checkuser(String uname, String pass) {

    boolean check = false;
    int isexist = 0;
    String lp = String.valueOf(pass.hashCode());
    //这里调用数据库的连接类
    workflow_DB_connection db_conn = new workflow_DB_connection(); ;
    try {
      db_conn.rs = db_conn.stmt.executeQuery
          ("select count(*) from user where loginname = '" + uname +
           "' and pass = '" + lp + "'  ");
      if (db_conn.rs.next()) {

        isexist = db_conn.rs.getInt(1);

        if (isexist == 1) {
          check = true;

        }
      }

      db_conn.rs.close();
      db_conn.stmt.close();
      db_conn.conn.close();

    }
    catch (Exception e) {
      System.out.println("获得用户登录信息" + e);
    }
    return check;
  }

// 主方法
  public static void main(String argv[]) {

    WorkFlow_LoginMain wl = new WorkFlow_LoginMain();

    jf = new JFrame();
    jf.setDefaultCloseOperation(jf.EXIT_ON_CLOSE);
    BorderLayout borderLayout1 = new BorderLayout();
    jf.getContentPane().setLayout(borderLayout1);
    jf.getContentPane().add(wl, borderLayout1.CENTER);

    jf.setResizable(false);

    //   jf.setLocationRelativeTo(null);
    //   JF居中........

    java.awt.Dimension screenSize =
        java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    jf.setLocation( (screenSize.width - jf.getWidth()) / 2,
                   (screenSize.height - jf.getHeight()) / 2);

    jf.setTitle("方法数码工作流管理系统");
    jf.pack();
    jf.show();

  }

}

// JB的BUTTION的actionadpater
class WorkFlow_LoginMain_jButton1_actionAdapter
    implements java.awt.event.ActionListener {
  WorkFlow_LoginMain adaptee;

  WorkFlow_LoginMain_jButton1_actionAdapter(WorkFlow_LoginMain adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jButton1_actionPerformed(e);
  }
}

class WorkFlow_LoginMain_jButton2_actionAdapter
    implements java.awt.event.ActionListener {
  WorkFlow_LoginMain adaptee;

  WorkFlow_LoginMain_jButton2_actionAdapter(WorkFlow_LoginMain adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jButton2_actionPerformed(e);
  }
}

⌨️ 快捷键说明

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