⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 enter.java

📁 用eclipse编写的图书管理系统
💻 JAVA
字号:
package client;

import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Timer;
import java.util.TimerTask;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
import com.swtdesigner.SwingResourceManager;

import sever.business.iface.ILibrarianInfoIface;
import sever.business.impl.IlibrarianInfoImpl;
import sever.dao.LibrarianInfoDAO;
import sever.entity.LibrarianInfo;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

public class Enter extends JFrame {

	private JPasswordField passwordField;

	private JTextField textField;

	/**
	 * Launch the application
	 * 
	 * @param args
	 */
	ImageIcon image = new ImageIcon("E:\\image\\111.JPG");

	ImageIcon image2 = new ImageIcon("E:\\image\\222.JPG");

	ImageIcon image3 = new ImageIcon("E:\\image\\登陆N.JPG");

	public static void main(String args[]) {
		try {
			Enter frame = new Enter();
			frame.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}


	public Enter() {

		super();
		setIconImage(SwingResourceManager.getImage(Enter.class, "/LOGO.jpg"));
		getContentPane().setLayout(null);
		setBounds(350, 240, 296, 253);
		setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

		final JLabel label=new JLabel();
		label.setFont(new Font("@黑体", Font.PLAIN, 14));
		label.setText("用户名:");
		label.setBounds(40, 75, 60, 15);
		getContentPane().add(label);

		final JLabel label_2 = new JLabel();
		label_2.setFont(new Font("@黑体", Font.PLAIN, 14));
		label_2.setText("密  码:");
		label_2.setBounds(40, 116, 60, 15);
		getContentPane().add(label_2);

		textField = new JTextField();
		textField.setBounds(106, 72, 127, 21);
		getContentPane().add(textField);

		passwordField = new JPasswordField();
		passwordField.setToolTipText("请输入6位数的密码");
		passwordField.setBounds(106, 111, 127, 24);
		getContentPane().add(passwordField);

		final JButton button = new JButton(image);
		getRootPane().setDefaultButton(button);          //按回车可登陆
		button.setText("确认");

		button.setFont(new Font("@黑体", Font.PLAIN, 14));
		button.setBounds(53, 163, 69, 25);
		getContentPane().add(button);

		final JButton button_1 = new JButton(image2);
		button_1.setText("取消");
		button_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				System.exit(0);
			}
		});
		button_1.setFont(new Font("@黑体", Font.PLAIN, 14));
		button_1.setBounds(162, 163, 69, 25);
		getContentPane().add(button_1);

		label_1 = new JLabel(image3);
		label_1.setBounds(0, -5, 291, 236);
		getContentPane().add(label_1);
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				
				if(passwordField.getText().length()<6){
					JOptionPane.showMessageDialog(null, "密码不能少于6位", "错误",
							JOptionPane.ERROR_MESSAGE);
				}else{
				librar.setLibrarianName(textField.getText().trim());

				librar.setLibrarianPass(passwordField.getText().trim());

				
				load.setVisible(true);
				setVisible(false);
				
				start();
				}

			}

		});
	}

	public Loading load=new Loading();
	public JLabel label_1; 
	public LibrarianInfo librar = new LibrarianInfo();
	
    private final Timer timer = new Timer();

    public void start() {
        timer.schedule(new TimerTask() {
            public void run() {
            	
				ILibrarianInfoIface face = new IlibrarianInfoImpl();
            	boolean boo = face.enter(librar);

				if (boo == true) {
					label_1.setIcon(new ImageIcon("E:\\image\\登陆.gif"));
					label_1.show(true);
					load.dispose();
					Owner owner = new Owner();
					owner.setVisible(true);
					dispose();
				} else {
					load.dispose();

					JOptionPane.showMessageDialog(null, "用户名错误或密码错误", "错误",
							JOptionPane.ERROR_MESSAGE);
					setVisible(true);
				}
            }	

        }, 2008);
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -