企业进销存管理系统登录界面

上传人:油条 文档编号:115973973 上传时间:2019-11-15 格式:DOCX 页数:7 大小:12.79KB
返回 下载 相关 举报
企业进销存管理系统登录界面_第1页
第1页 / 共7页
企业进销存管理系统登录界面_第2页
第2页 / 共7页
企业进销存管理系统登录界面_第3页
第3页 / 共7页
企业进销存管理系统登录界面_第4页
第4页 / 共7页
企业进销存管理系统登录界面_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《企业进销存管理系统登录界面》由会员分享,可在线阅读,更多相关《企业进销存管理系统登录界面(7页珍藏版)》请在金锄头文库上搜索。

1、package com.lzw.login;import java.awt.*;import java.awt.event.*;import java.sql.SQLException;import javax.swing.*;import com.lzw.MainFrame;import com.lzw.dao.Dao;public class LoginDialog extends JFrame private static final long serialVersionUID = 1L;private LoginPanel loginPanel = null;private JLabe

2、l jLabel = null;private JTextField userField = null;private JLabel jLabel1 = null;private JPasswordField passwordField = null;private JButton loginButton = null;private JButton exitButton = null;private static String userStr;private MainFrame mainFrame;/* * param owner */public LoginDialog() try UIM

3、anager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName();mainFrame = new MainFrame();initialize(); catch (Exception e) e.printStackTrace();/* * 初始化loginPanel登录面板的方法 * * return com.lzw.login.LoginPanel */private LoginPanel getLoginPanel() if (loginPanel = null) jLabel1 = new JLabel();jLabel1.s

4、etBounds(new Rectangle(86, 71, 55, 18);jLabel1.setText(密码:);jLabel = new JLabel();jLabel.setText(用户名:);jLabel.setBounds(new Rectangle(85, 41, 56, 18);loginPanel = new LoginPanel();loginPanel.setLayout(null);loginPanel.setBackground(new Color(0xD8DDC7);loginPanel.add(jLabel, null);loginPanel.add(getU

5、serField(), null);loginPanel.add(jLabel1, null);loginPanel.add(getPasswordField(), null);loginPanel.add(getLoginButton(), null);loginPanel.add(getExitButton(), null);return loginPanel;/* * This method initializes userField * * return javax.swing.JTextField */private JTextField getUserField() if (use

6、rField = null) userField = new JTextField();userField.setBounds(new Rectangle(142, 39, 127, 22);return userField;/* * This method initializes passwordField * * return javax.swing.JPasswordField */private JPasswordField getPasswordField() if (passwordField = null) passwordField = new JPasswordField()

7、;passwordField.setBounds(new Rectangle(143, 69, 125, 22);passwordField.addKeyListener(new java.awt.event.KeyAdapter() public void keyTyped(java.awt.event.KeyEvent e) if(e.getKeyChar()=n)loginButton.doClick(););return passwordField;/* * This method initializes loginButton * * return javax.swing.JButt

8、on */private JButton getLoginButton() if (loginButton = null) loginButton = new JButton();loginButton.setBounds(new Rectangle(109, 114, 48, 20);loginButton.setIcon(new ImageIcon(getClass().getResource(/res/loginButton.jpg);loginButton.addActionListener(new ActionListener() public void actionPerforme

9、d(ActionEvent e) try userStr = userField.getText();String passStr = new String(passwordField.getPassword();if (!Dao.checkLogin(userStr, passStr) JOptionPane.showMessageDialog(LoginDialog.this,用户名与密码无法登录, 登录失败,JOptionPane.ERROR_MESSAGE);return; catch (Exception e1) e1.printStackTrace();mainFrame.setD

10、efaultCloseOperation(JFrame.EXIT_ON_CLOSE);mainFrame.setVisible(true);mainFrame.getCzyStateLabel().setText(userStr);setVisible(false););return loginButton;/* * This method initializes exitButton * * return javax.swing.JButton */private JButton getExitButton() if (exitButton = null) exitButton = new

11、JButton();exitButton.setBounds(new Rectangle(181, 114, 48, 20);exitButton.setIcon(new ImageIcon(getClass().getResource(/res/exitButton.jpg);exitButton.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent e) System.exit(0););return exitButton;/*

12、 * 界面初始化方法 * * return void */private void initialize() Dimension size = getToolkit().getScreenSize();setLocation(size.width - 296) / 2, (size.height - 188) / 2);setSize(296, 188);this.setTitle(系统登录);setContentPane(getLoginPanel();public String getUserStr() return userStr; / jve:decl-index=0:visual-constraint=10,10

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 中学教育 > 其它中学文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号