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

📄 logindialog.java~4~

📁 ACCP课程中的商业程序网吧管理系统
💻 JAVA~4~
字号:
package com.jbaptech.accp.netbar.client;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.WindowEvent;

/**
 *
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2005</p>
 *
 * <p>Company: 北京阿博泰克北大青鸟信息技术有限公司</p>
 *
 * @author luohao
 * @version 1.0
 */
public class LoginDialog extends JDialog{
   JPanel panel1 = new JPanel();
   JLabel jLabel1 = new JLabel();
   JTextField jTextField1 = new JTextField();
   JLabel jLabel2 = new JLabel();
   JButton confirmButton = new JButton();
   JButton resetButton = new JButton();
   JLabel jLabel3 = new JLabel();
   JPasswordField jPasswordField1 = new JPasswordField();
   BorderLayout borderLayout1 = new BorderLayout();

   public LoginDialog(NetBarFeeMangementFrame frame, String title, boolean modal) {
     super(frame, title, modal);
     Frame1 = frame;
     this.setLocation(250,200);
     try {
       jbInit();
       pack();
     }
     catch(Exception ex) {
       ex.printStackTrace();
     }
   }

   public LoginDialog() {
     this(null, "", false);
   }
   private void jbInit() throws Exception {
     panel1.setLayout(null);
     this.getContentPane().setLayout(borderLayout1);

     panel1.setPreferredSize(new Dimension(300, 200));
     panel1.setRequestFocusEnabled(true);

     jLabel3.setFont(new java.awt.Font("Serif", 1, 16));
     jLabel3.setForeground(Color.blue);
     jLabel3.setHorizontalAlignment(SwingConstants.CENTER);
     jLabel3.setText("欢迎查询,请输卡号、密码");
     jLabel3.setBounds(new Rectangle(0, 10, 300, 30));

     jLabel1.setFont(new java.awt.Font("Serif", 1, 13));
     jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
     jLabel1.setText("卡号:");
     jLabel1.setBounds(new Rectangle(80, 60, 45, 25));

     jTextField1.setText("88888888");
     jTextField1.setBounds(new Rectangle(125, 60, 95, 25));

     jLabel2.setFont(new java.awt.Font("Serif", 1, 13));
     jLabel2.setText("密码:");
     jLabel2.setBounds(new Rectangle(80, 110, 45, 25));

     jPasswordField1.setText("88888888");
     jPasswordField1.setBounds(new Rectangle(125, 110, 95, 25));

     confirmButton.setBounds(new Rectangle(75, 150, 60, 25));
     confirmButton.setText("确定");
     confirmButton.addActionListener(new LoginDialog_confirmButton_actionAdapter(this));
     resetButton.setBounds(new Rectangle(165, 150, 60, 25));
     resetButton.setText("重置");
     resetButton.addActionListener(new LoginDialog_resetButton_actionAdapter(this));

     getContentPane().add(panel1, BorderLayout.CENTER);
     panel1.add(jLabel2, null);
     panel1.add(jLabel3, null);
     panel1.add(jPasswordField1, null);
     panel1.add(jTextField1, null);
     panel1.add(jLabel1, null);
     panel1.add(confirmButton, null);
     panel1.add(resetButton, null);

    // con = barConnect.getconn();
   }

   void resetButton_actionPerformed(ActionEvent e) {
     jTextField1.setText("");
     jPasswordField1.setText("");
   }

   void confirmButton_actionPerformed(ActionEvent e) {
    /*
     try{
       if(jTextField1.getText().trim()!= null){
         stmt = con.createStatement();
         String loginQuery =  "";
         String passwordtemp = "";
         for(int i=0;i<jPasswordField1.getPassword().length;i++)
         {
           passwordtemp += jPasswordField1.getPassword()[i];
         }
         loginQuery = "select * from Card where CardID = " +
                                     Integer.parseInt(jTextField1.getText().trim()) +
                                     " and password = "+passwordtemp;

        ResultSet rs = stmt.executeQuery(loginQuery);
         if (rs.next()) {
           Frame1.login_true();
           Frame1.SetCardID(Integer.parseInt(jTextField1.getText().trim()));
           rs.close();
           con.close();
           this.hide();
           return;
         }
         else{
           Frame1.login_false();
           jTextField1.setText("卡号或者密码错误。");
         }

       }
     }
     catch(SQLException ex){
       System.out.print("系统或者输进数据错误!"+ex.toString());
     }
     */
   }

   protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      Frame1.login_false();
      this.hide();
    }
  }

   //private Connection con;
   private NetBarFeeMangementFrame Frame1;
   //private Statement stmt;
 }

 class LoginDialog_resetButton_actionAdapter implements java.awt.event.ActionListener {
   LoginDialog adaptee;

   LoginDialog_resetButton_actionAdapter(LoginDialog adaptee) {
     this.adaptee = adaptee;
   }
   public void actionPerformed(ActionEvent e) {
     adaptee.resetButton_actionPerformed(e);
   }
 }

 class LoginDialog_confirmButton_actionAdapter implements java.awt.event.ActionListener {
   LoginDialog adaptee;

   LoginDialog_confirmButton_actionAdapter(LoginDialog adaptee) {
     this.adaptee = adaptee;
   }
   public void actionPerformed(ActionEvent e) {
     adaptee.confirmButton_actionPerformed(e);
  }
}

⌨️ 快捷键说明

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