基本信息
源码名称:Java swing开发的GUI图书馆后台管理系统,可做为java毕业设计
源码大小:1.19M
文件格式:.zip
开发语言:Java
更新时间:2019-03-12
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
package gui;
import java.awt.EventQueue;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.JButton;
import dao.impl.UserDaoImpl;
import model.lay_user;
/**
* @author ggg
*
*/
public class LoginUI {
private JFrame frame;
private JTextField textField;
private JTextField textField_1;
UserDaoImpl userdao = new UserDaoImpl();
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
LoginUI window = new LoginUI();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public LoginUI() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("图书进存销系统");
frame.setBounds(100, 100, 420, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
JLabel label = new JLabel("账户:");
label.setBounds(55, 75, 72, 18);
frame.getContentPane().add(label);
textField = new JTextField();
textField.setBounds(111, 72, 260, 24);
frame.getContentPane().add(textField);
textField.setColumns(10);
JLabel label_1 = new JLabel("密码:");
label_1.setBounds(55, 145, 72, 18);
frame.getContentPane().add(label_1);
JPasswordField passwordField = new JPasswordField();
passwordField.setBounds(111, 142, 260, 24);
frame.getContentPane().add(passwordField);
JButton button = new JButton("登录");
button.setBounds(258, 199, 113, 27);
frame.getContentPane().add(button);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
String name = textField.getText();
String upass = String.valueOf(passwordField.getPassword());
lay_user usr = new lay_user();
usr.setName(name);
usr.setPassword(upass);
if (userdao.QueryByName(name) != null) {
JOptionPane.showMessageDialog(null, "成功");
frame.setVisible(false);
BuyUI buyui = new BuyUI();
buyui.setVisible(true);
} else {
System.out.println("失败");
}
}
});
}
}