永发信息网

求一个java图书管管理软件登陆界面系统代码

答案:1  悬赏:10  手机版
解决时间 2021-11-12 07:47
求一个java图书管管理软件登陆界面系统代码
最佳答案
package pack_view;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowEvent;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.plaf.multi.MultiLookAndFeel;

import pack_DB.DB;

public class Login extends JFrame{

private static final long serialVersionUID = 1L;
JFrame jf = new JFrame();
private JPanel panel_all ;
private JPanel panel1 = new JPanel();
private JPanel panel2= new JPanel();
private JPanel panel3 = new JPanel();
private JPanel panel4 = new JPanel();
private JLabel jLabel_title;
private JLabel jLabel_name = new JLabel();
private JLabel jLabel_password = new JLabel();
private JTextField jTextField_name = new JTextField(15);
private JPasswordField jPasswordField = new JPasswordField(15);
private JButton jb1 = new JButton();
private JButton jb2 = new JButton();
private Font font;

String cid="";
String passwd ="";

//加载背景图片
// private ImageIcon imageicon;
// private Image image;

public Login() {
jf.setTitle("客户端登陆");
jf.setSize(350, 300);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();//把用户的显示器屏幕的尺寸(长和宽)赋值给变量screenSize
Dimension frameSize = jf.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}

//把弹出的对话框窗口放置在屏幕中间
jf.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);

// imageicon = new ImageIcon(ClassLoader
// .getSystemResource("res/backgound.jpg".toString()));
panel_all = new JPanel(){
public void paintComponent(Graphics g){
super.paintComponents(g);
// image = imageicon.getImage();
// if(image != null)
// g.drawImage(image,0,0,getWidth(),getHeight(),this);
}
};

font=new Font("宋体正文", 0,20);
jLabel_title = new JLabel(new ImageIcon(ClassLoader
.getSystemResource("res/Login.jpg".toString())));
jLabel_title.setFont(font);
jLabel_title.setText("用户登陆");

jLabel_name.setFont(new java.awt.Font("Dialog", 0, 14));
jLabel_name.setText("用户名:");
jLabel_password.setFont(new java.awt.Font("Dialog", 0, 14));
jLabel_password.setText("密 码:");
jb1.setFont(new java.awt.Font("Dialog", 0, 18));
jb1.setText("确 认");
jb2.setText("取 消");
jb2.setFont(new java.awt.Font("Dialog", 0, 18));

jTextField_name.addKeyListener(new KeyAdapter()
{
public void keyPressed(KeyEvent e)
{
if(e.getKeyCode()==KeyEvent.VK_ENTER)

{
jb1.doClick();
}
}});
jPasswordField.addKeyListener(new KeyAdapter()
{
public void keyPressed(KeyEvent e)
{
if(e.getKeyCode()==KeyEvent.VK_ENTER)

{
jb1.doClick();
}
}});

panel1.add(jLabel_name);
panel1.add(jTextField_name);
panel2.add(jLabel_password);
panel2.add(jPasswordField);
panel3.add(jb1);
panel3.add(jb2);
panel4.add(jLabel_title);

panel_all.setLayout(new GridLayout(4,1));
panel_all.add(panel4);
panel_all.add(panel1);
panel_all.add(panel2);
panel_all.add(panel3);

panel_all.setOpaque(false);
jf.setLayout(new BorderLayout());
jf.add(panel_all);

jb1.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent me){
// if(lc.validate(jTextField_name.getText().trim(),new String(jPasswordField.getPassword()).trim())){

// doLogin();

// new MainFrame();
// }
// else
// JOptionPane.showMessageDialog(null, "Password doesn't match account,please try again!");

}

});

jb2.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent me){
System.exit(0);
}
});

jf.setVisible(true);
jf.repaint();
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}


public static void main(String[] args) {
// TODO Auto-generated method stub
new Login();
}

}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
养子不善养老人有没有继承权
我的多肉植物怎么突然茎杆弯了
我的s9+夜间用闪光灯拍照怎么这样
5、7、13、15、23、25、2。双色球有没有中过
整改措施怎么写
google chrome的扩展程序里没有迅雷。
平时看小说总会看见“淡淡道”的这样的字眼
最近约太多了,我到底该如何抉择
东澳邮政所地址在什么地方,想过去办事,
如何区分拔了毛的黑白山羊?
合肥到余姚413公里处在哪
怎么才可以挂Q永远不掉线
9号去迪拜 有几个问题各位大侠
农村自建房90平米左右,我想把客厅设计成高度
春季喝什么茶好?
推荐资讯
一盒饼干重500什么
150吨循环流化床锅炉出渣量是多少
重庆威泓物流有限公司地址在哪,我要去那里办
桃园和精灵传说哪个好玩
情趣是什么意思!
东风L60仪表盘显示S丅0p打不着火
路遇一美女,脚好像受伤了,走得很慢,我该怎
魔法少女小圆结局问题
如何用如何用ansys构造一个u型槽
8位同学聚会,见面后每两人爻间要握手相互问
硬之城运营模式是怎样的?
1安培开关可用多少功率电器
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?