package com.jx.frame;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.border.TitledBorder;
import com.jx.dto.Manager;
import com.jx.dao.ManagerDao;
public class LoginFrame extends JFrame implements ActionListener{
JLabel mLogin = new JLabel(new ImageIcon("image/li.jpg"));
JLabel mName = new JLabel();
JLabel mpwd = new JLabel();
JTextField text_manager = new JTextField();
JButton button_ok = new JButton(new ImageIcon("image/yes.jpg"));
JButton button_cancel = new JButton(new ImageIcon("image/exit.jpg"));
JPasswordField text_password = new JPasswordField();
TitledBorder titledBorder1 = new TitledBorder("");
TitledBorder titledBorder2 = new TitledBorder("");
TitledBorder titledBorder3 = new TitledBorder("");
TitledBorder titledBorder4 = new TitledBorder("");
JLabel lblbiao = new JLabel();
TitledBorder titledBorder5 = new TitledBorder("");
JButton btnanniao = new JButton(new ImageIcon("image/key.jpg"));
// private JLabel managername, password;
// private JTextField text_manager; // 用户名文本行
// private JPasswordField text_password; // 密码文本行
//
// private JButton button_ok, button_cancel;
// public boolean isLogin = false; // 判断登录是否成功
public LoginFrame() {
super("系统登录");
this.setSize(350, 200);
this.setLocation(550, 200);
this.setBackground(Color.lightGray);
this.setResizable(false);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.getContentPane().setLayout(new FlowLayout());
mLogin.setBackground(SystemColor.inactiveCaptionText);
mLogin.setPreferredSize(new Dimension(123, 95));
this.getContentPane().setLayout(null);
mLogin.setText("");
mLogin.setBounds(new Rectangle(10, 20, 75, 70));
this.getContentPane().setBackground(UIManager.getColor("Label.background"));
this.setForeground(Color.lightGray);
// lblName.setBackground(Color.black);
// lblName.setFont(new java.awt.Font("宋体", Font.BOLD, 13));
// lblName.setForeground(Color.blue);
// lblName.setFont(new java.awt.Font("宋体", Font.PLAIN, 13));
// lblName.setBorder(BorderFactory.createLoweredBevelBorder());
// lblName.setText("");
// lblName.setBounds(new Rectangle(191, 26, 110, 25));
// text_manager.addActionListener(this);
mName.setFont(new java.awt.Font("宋体", Font.BOLD, 13));
mName.setForeground(Color.blue);
mName.setText("管理员账号:");
mName.setBounds(new Rectangle(93, 30, 86, 20));
mpwd.setFont(new java.awt.Font("宋体", Font.BOLD, 13));
mpwd.setForeground(Color.blue);
mpwd.setText("管理员密码:");
mpwd.setBounds(new Rectangle(93, 63, 86, 24));
button_ok.setBounds(new Rectangle(73, 109, 79, 22));
button_ok.setFont(new java.awt.Font("宋体", Font.PLAIN, 13));
button_ok.setBorder(BorderFactory.createRaisedBevelBorder());
button_ok.setPreferredSize(new Dimension(79, 22));
button_ok.setText("");
this.getContentPane().add(button_ok);
// button_ok.setActionCommand("enter");
button_ok.addActionListener(this);
button_cancel.setBounds(new Rectangle(179, 109, 79, 23));
button_cancel.setFont(new java.awt.Font("宋体", Font.PLAIN, 13));
button_cancel.setBorder(BorderFactory.createRaisedBevelBorder());
button_cancel.setPreferredSize(new Dimension(79, 23));
button_cancel.setText("");
this.getContentPane().add(button_cancel);
// button_cancel.setActionCommand("Exit");
button_cancel.addActionListener(this);
text_manager.setBorder(BorderFactory.createLoweredBevelBorder());
text_manager.setText("");
text_manager.setBounds(new Rectangle(191, 30, 110, 25));
text_password.setBorder(BorderFactory.createLoweredBevelBorder());
text_password.setText("");
text_password.setBounds(new Rectangle(191, 63, 110, 25));
lblbiao.setForeground(Color.red);
lblbiao.setText("");
lblbiao.setBounds(new Rectangle(192, 89, 108, 19));
// btnanniao.setBounds(new Rectangle(173, 72, 18, 10));
// btnanniao.setPreferredSize(new Dimension(18, 10));
// btnanniao.addActionListener(this);
this.getContentPane().add(text_manager);
this.getContentPane().add(text_password);
this.getContentPane().add(mLogin);
this.getContentPane().add(button_cancel);
this.getContentPane().add(button_ok);
this.getContentPane().add(lblbiao);
this.getContentPane().add(mpwd);
this.getContentPane().add(mName);
this.getContentPane().add(btnanniao);
this.setVisible(true);
// super("用户登录");
// this.setSize(240, 120);
// this.setLocation(550, 200);
// this.setBackground(Color.lightGray);
// this.setResizable(false);
// this.setDefaultCloseOperation(EXIT_ON_CLOSE);
// this.getContentPane().setLayout(new FlowLayout());
//
//
// managername = new JLabel("用户名:");
// managername.setFont(new Font("Dialog", 0, 12));
// this.getContentPane().add(managername);
// text_manager = new JTextField("admin",15);
// this.getContentPane().add(text_manager);
// password = new JLabel("密 码:");
// password.setFont(new Font("Dialog", 0, 12));
// this.getContentPane().add(password);
// text_password = new JPasswordField("1111",15);
// this.getContentPane().add(text_password);
//
// button_ok = new JButton("登录");
// button_ok.setFont(new Font("Dialog", 0, 12));
// this.getContentPane().add(button_ok);
// button_ok.addActionListener(this);
// button_cancel = new JButton("取消");
// button_cancel.setFont(new Font("Dialog", 0, 12));
// this.getContentPane().add(button_cancel);
// button_cancel.addActionListener(this);
// this.setVisible(true);
}
public void actionPerformed(ActionEvent e) // 单击事件处理方法
{
Manager manager = new Manager();
String managername = text_manager.getText();
if (managername.equals(""))
lblbiao.setText("请输入用户名!");
// JOptionPane.showMessageDialog(this, "请输入用户名");
else
if (new String(text_password.getPassword()).equals(""))
lblbiao.setText("请输入用户密码!");
// JOptionPane.showMessageDialog(this, "请输入mima");
String password =new String(text_password.getPassword());
manager.setManagername(managername);
manager.setPassword(password);
if (e.getSource() == button_cancel) // 单击退出按钮
{
this.setVisible(false);
}
else if (e.getSource() == button_ok)// 单击登录按钮
{
System.out.println(managername);
System.out.println(password);
ManagerDao managerDao = new ManagerDao();
Manager m = managerDao.validate(manager);
if(m == null)
{
lblbiao.setText("用户名或密码不正确!");
// JOptionPane.showMessageDialog(this, "用户名或者密码错误");
return;
}
new MyJFrame(manager);
}
}
public static void main(String args[]) throws Exception // 测试方法
{
new LoginFrame();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
仓库管理系统 java+sql server (102个子文件)
FileLY.class 7KB
CKJFrameGL.class 7KB
CGJFrameGL.class 7KB
XQJFrameGL.class 6KB
GHJFrameGL.class 6KB
MyJFrame.class 6KB
LoginFrame.class 5KB
PageSwitch.class 5KB
CKJFrameView.class 5KB
XQJFrameView.class 4KB
CGJFrameView.class 4KB
GHJFrameView.class 4KB
RKJFrameView.class 4KB
CGDao.class 4KB
ManagerDao.class 4KB
Scan.class 3KB
PageSwitch$InDuilie.class 3KB
Elevator.class 3KB
KCDao.class 3KB
SSTF.class 2KB
XQDao.class 2KB
KCJFrameView.class 2KB
CKDao.class 2KB
GHDao.class 2KB
PageSwitch$Confirm.class 2KB
PageSwitch$Confirm1.class 2KB
CangkuHandler.class 2KB
CKInfo.class 2KB
DBcon.class 2KB
CGInfo.class 2KB
RKInfo.class 2KB
FCFS.class 2KB
GHInfo.class 1KB
KCInfo.class 1KB
DateType.class 1KB
XQInfo.class 1KB
RKDao.class 1005B
Manager.class 935B
.classpath 627B
LoginFrame.java 8KB
FileLY.java 8KB
CangkuHandler.java 7KB
PageSwitch.java 7KB
MyJFrame.java 6KB
CKJFrameGL.java 6KB
GHJFrameView.java 6KB
CGJFrameGL.java 6KB
XQJFrameGL.java 5KB
CKJFrameView.java 5KB
GHJFrameGL.java 5KB
XQJFrameView.java 5KB
RKJFrameView.java 5KB
CGJFrameView.java 3KB
Scan.java 3KB
CGDao.java 3KB
ManagerDao.java 3KB
Elevator.java 3KB
SSTF.java 2KB
KCDao.java 2KB
XQDao.java 2KB
DBcon.java 1KB
CKDao.java 1KB
KCJFrameView.java 1KB
GHDao.java 1KB
CKInfo.java 1KB
CGInfo.java 1KB
RKInfo.java 1KB
FCFS.java 941B
GHInfo.java 904B
DateType.java 697B
KCInfo.java 685B
XQInfo.java 642B
RKDao.java 581B
Manager.java 553B
Login.jpg 95KB
19.jpg 12KB
2.jpg 9KB
22.jpg 9KB
25.jpg 9KB
21.jpg 9KB
10.jpg 8KB
39.jpg 8KB
23.jpg 8KB
28.jpg 8KB
24.jpg 8KB
li.jpg 2KB
quxiao.jpg 1KB
Del.jpg 1KB
Updates.jpg 1KB
Next.jpg 1KB
Adds.jpg 1KB
Exits.jpg 1KB
Save.jpg 1KB
Up.jpg 1KB
yes.jpg 1KB
exit.jpg 1KB
select.jpg 1KB
fix.jpg 932B
title.jpg 776B
key.jpg 759B
共 102 条
- 1
- 2
jixu132578
- 粉丝: 1
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页