求一个java图书管管理软件登陆界面系统代码
答案:1 悬赏:10 手机版
解决时间 2021-11-12 07:47
- 提问者网友:戎马万世
- 2021-11-12 02:24
求一个java图书管管理软件登陆界面系统代码
最佳答案
- 五星知识达人网友:归鹤鸣
- 2021-11-12 02:43
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();
}
}
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();
}
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯