用java gui毕业设计题目_Java swing开发的GUI图书馆后台管理系统,可做为java毕业设计...

这是一个使用Java GUI(Swing)开发的图书馆后台管理系统登录界面。通过输入账户和密码,用户可以登录系统。核心代码展示了如何创建窗口、布局元素以及处理登录事件,通过UserDaoImpl查询用户并判断登录是否成功。
摘要由CSDN通过智能技术生成

【实例简介】

【实例截图】

5cf9c15fc643963618aed492df603886.png

75f70b832c4dba18375d3a720060bf13.png

【核心代码】

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("失败");

}

}

});

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值