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

📄 loggingin.java~38~

📁 酒店信息管理系统包括客户的信息
💻 JAVA~38~
字号:
package hotelinformationmanagesystem;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JLabel;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JPanel;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import javax.swing.JRootPane;

/**
 * <p>Title: 酒店信息管理系统</p>
 *
 * <p>Description: The Management Information System of Hotel</p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: JSP</p>
 *
 * @author 江世澎
 * @version 1.0
 */
public class LoggingIn extends JFrame {
    XYLayout xYLayout1 = new XYLayout();
    JPanel jPShowLogInf = new JPanel();
    XYLayout xYLayout2 = new XYLayout();
    JPanel jPShowCommand = new JPanel();
    XYLayout xYLayout3 = new XYLayout();
    JLabel jLShowID = new JLabel();
    JLabel JLShowPassword = new JLabel();
    JTextField jTGetEmpID = new JTextField();
    JPasswordField jPGetPassword = new JPasswordField();
    JButton jBAffirm = new JButton();
    JButton jBExit = new JButton();

    ReturnPopedom repopedom = new ReturnPopedom(); //定义一个返回权限的一个类对象
    MainFrame mainframe = new MainFrame();//定义一个主窗体类对象

    public LoggingIn() {
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        getContentPane().setLayout(xYLayout1);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setSize(305, 205);
        this.setResizable(false);
        this.setTitle("欢迎使用酒店信息管理系统");
        jPShowLogInf.setBorder(BorderFactory.createEtchedBorder());
        jPShowLogInf.setToolTipText("请输入您的ID与密码");
        jPShowLogInf.setLayout(xYLayout2);
        jPShowCommand.setBorder(BorderFactory.createEtchedBorder());
        jPShowCommand.setToolTipText("请选择进入或选择退出");
        jPShowCommand.setLayout(xYLayout3);
        jLShowID.setFont(new java.awt.Font("宋体", Font.BOLD, 25));
        jLShowID.setToolTipText("请输入您的ID");
        jLShowID.setText("员工 ID");
        JLShowPassword.setFont(new java.awt.Font("宋体", Font.BOLD, 25));
        JLShowPassword.setToolTipText("请输入您的密码");
        JLShowPassword.setText("密   码");
        jTGetEmpID.setFont(new java.awt.Font("宋体", Font.BOLD, 25));
        jTGetEmpID.setBorder(BorderFactory.createEtchedBorder());
        jTGetEmpID.setToolTipText("请输入您的ID");
        jPGetPassword.setFont(new java.awt.Font("Dialog", Font.BOLD, 20));
        jPGetPassword.setBorder(BorderFactory.createEtchedBorder());
        jPGetPassword.setToolTipText("请输入您的密码");
        xYLayout1.setWidth(300);
        xYLayout1.setHeight(174);
        jBAffirm.setFont(new java.awt.Font("宋体", Font.BOLD, 20));
        jBAffirm.setToolTipText("欢迎进入本系统");
        jBAffirm.setText("确认");
        jBAffirm.addActionListener(new LoggingIn_jBAffirm_actionAdapter(this));
        jBExit.setFont(new java.awt.Font("宋体", Font.BOLD, 20));
        jBExit.setToolTipText("欢迎下次使用");
        jBExit.setText("退出");
        jBExit.addActionListener(new LoggingIn_jBExit_actionAdapter(this));
        jPShowLogInf.add(jLShowID, new XYConstraints(9, 7, -1, -1));
        jPShowLogInf.add(JLShowPassword, new XYConstraints(9, 63, 98, -1));
        jPShowLogInf.add(jTGetEmpID, new XYConstraints(136, 5, 147, 36));
        jPShowLogInf.add(jPGetPassword, new XYConstraints(136, 61, 147, 36));
        this.getContentPane().add(jPShowLogInf,
                                  new XYConstraints(3, 4, 294, 120));
        jPShowCommand.add(jBAffirm, new XYConstraints(9, 2, 96, 37));
        jPShowCommand.add(jBExit, new XYConstraints(182, 2, 95, 37));
        this.getContentPane().add(jPShowCommand,
                                  new XYConstraints(3, 126, 294, 45));
        //----------------------------------------------------------------------
        mainframe.setVisible(true); //设置主窗体为可见
        mainframe.setEnabled(false); //设置主窗体为不可用
        this.setVisible(true);

        SetFormCenter windowcenter = new SetFormCenter();
        windowcenter.setcenter(this);

        JRootPane root = this.getRootPane(); //当输入完密码后
        root.setDefaultButton(jBAffirm); //便自动换到“确定”

    }

    public static void main(String[] args) {
        LoggingIn loggingin = new LoggingIn();
    }

    public void jBAffirm_actionPerformed(ActionEvent e) {
        repopedom.returnpower(this);
        String strNowEmpID = repopedom.strEmpID; //用于存放用户的ID号
        String strNowPassword = repopedom.strPassword; //用于存放用户的密码
        String strNowPower = repopedom.strPopedom; //用于存放用户的权限
        if (strNowPower == null) {
            return;
        }
        switch (strNowPower.charAt(0)) {
        case '0': //系统管理员
            mainframe.setEnabled(true);
            mainframe.jMUserManage.setVisible(false);
            mainframe.jLGetDepartment.setText(repopedom.strDepartment);
            mainframe.jLGetDuty.setText(repopedom.strDuty);
            mainframe.jLGetName.setText(repopedom.strName);
            mainframe.jMRoomState.setEnabled(true);
            break;
        case '1': //服务部经理
            mainframe.setEnabled(true);
            mainframe.jMManagerInterface.setVisible(false);
            mainframe.jMRoomInfoManage.setEnabled(false);
            mainframe.jLGetDepartment.setText(repopedom.strDepartment);
            mainframe.jLGetDuty.setText(repopedom.strDuty);
            mainframe.jLGetName.setText(repopedom.strName);
            mainframe.jMRoomState.setEnabled(true);
            break;
        case '2': //客房部经理
            mainframe.setEnabled(true);
            mainframe.jMManagerInterface.setVisible(false);
            mainframe.jMEmpOnDutyManage.setEnabled(false);
            mainframe.jMGuestRegisterSet.setEnabled(false);
            mainframe.jMGuestPrearrangeSet.setEnabled(false);
            mainframe.jMGuestSettleAccounts.setEnabled(false);
            mainframe.jLGetDepartment.setText(repopedom.strDepartment);
            mainframe.jLGetDuty.setText(repopedom.strDuty);
            mainframe.jLGetName.setText(repopedom.strName);
            mainframe.jMRoomState.setEnabled(true);
            break;
        case '3': //前台服务员
            mainframe.setEnabled(true);
            mainframe.jMManagerInterface.setVisible(false);
            mainframe.jMRoomInfoSet.setEnabled(false);
            mainframe.jMEmpOnDutyManage.setEnabled(false);
            mainframe.jMEmpInfoQuery.setEnabled(false);
            mainframe.jLGetDepartment.setText(repopedom.strDepartment);
            mainframe.jLGetDuty.setText(repopedom.strDuty);
            mainframe.jLGetName.setText(repopedom.strName);
            mainframe.jMRoomState.setEnabled(false);
            mainframe.jMInfoQuery.setEnabled(false);

            break;
        case '4': //其它工作人员
            mainframe.setEnabled(true);
            mainframe.jMManagerInterface.setVisible(false);
            mainframe.jMRoomInfoSet.setEnabled(false);
            mainframe.jMEmpOnDutyManage.setEnabled(false);
            mainframe.jMEmpInfoQuery.setEnabled(false);
            mainframe.jMGuestInfoManage.setEnabled(false);
            mainframe.jMGuestSettleAccounts.setEnabled(false);
            mainframe.jMRoomState.setEnabled(false);
            mainframe.jLGetDepartment.setText(repopedom.strDepartment);
            mainframe.jLGetDuty.setText(repopedom.strDuty);
            mainframe.jLGetName.setText(repopedom.strName);
            break;
        default:
            break;
        }
    }

    public void jBExit_actionPerformed(ActionEvent e) {
        int inChoose = JOptionPane.showConfirmDialog(null, "是否退出本系统?!",
                "酒店信息管理系统提示", JOptionPane.YES_NO_OPTION);
        if (inChoose == 0) { //choose为0时,用户选则“是”
            System.exit(0); //退出系统
        } else {
            jTGetEmpID.setText("");
            jPGetPassword.setText(""); //清空文本框中内容
        }
    }
}


class LoggingIn_jBExit_actionAdapter implements ActionListener {
    private LoggingIn adaptee;
    LoggingIn_jBExit_actionAdapter(LoggingIn adaptee) {
        this.adaptee = adaptee;
    }

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


class LoggingIn_jBAffirm_actionAdapter implements ActionListener {
    private LoggingIn adaptee;
    LoggingIn_jBAffirm_actionAdapter(LoggingIn adaptee) {
        this.adaptee = adaptee;
    }

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

⌨️ 快捷键说明

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