publicclassBookLoginIFrameextendsJFrame{
privateclassBookResetActionimplementsActionListener{
publicvoidactionPerformed(finalActionEvente){
username.setText("");
password.setText("");
}
classBookLoginActionimplementsActionListener{
user=Dao.check(username.getText(),password.getText());
if(user.getName()!=null){
try{
Libraryframe=newLibrary();
frame.setVisible(true);
BookLoginIFrame.this.setVisible(false);
}catch(Exceptionex){
ex.printStackTrace();
}else{
privateJPasswordFieldpassword;
privateJTextFieldusername;
privateJButtonlogin;
privateJButtonreset;
privatestaticOperateruser;
/**
*Launchtheapplication
*@paramargs
*/
*Createtheframe
publicBookLoginIFrame(){
super();
finalBorderLayoutborderLayout=newBorderLayout();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
borderLayout.setVgap(10);
getContentPane().setLayout(borderLayout);
setBounds(100,100,285,194);
finalJPanelpanel=newJPanel();
panel.setLayout(newBorderLayout());
panel.setBorder(newEmptyBorder(0,0,0,0));
getContentPane().add(panel);
finalJPanelpanel_2=newJPanel();
finalGridLayoutgridLayout=newGridLayout(0,2);
gridLayout.setHgap(5);
gridLayout.setVgap(20);
panel_2.setLayout(gridLayout);
panel.add(panel_2);
finalJLabellabel=newJLabel();
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setPreferredSize(newDimension(0,0));
label.setMinimumSize(newDimension(0,0));
panel_2.add(label);
label.setText("用户名:");
username=newJTextField(20);
username.setPreferredSize(newDimension(0,0));
panel_2.add(username);
finalJLabellabel_1=newJLabel();
label_1.setHorizontalAlignment(SwingConstants.CENTER);
panel_2.add(label_1);
label_1.setText("密码:");
password=newJPasswordField(20);
password.setDocument(newMyDocument(6));
password.setEchoChar('*');//设置密码框的回显字符
password.addKeyListener(newKeyAdapter(){
publicvoidkeyPressed(finalKeyEvente){
if(e.getKeyCode()==10)
login.doClick();
});
panel_2.add(password);
finalJPanelpanel_1=newJPanel();
panel.add(panel_1,BorderLayout.SOUTH);
login=newJButton();
login.addActionListener(newBookLoginAction());
panel_1.add(login);
reset=newJButton();
reset.addActionListener(newBookResetAction());
reset.setText("重置");
panel_1.add(reset);
finalJLabeltupianLabel=newJLabel();
ImageIconloginIcon=CreatecdIcon.add("login.jpg");
tupianLabel.setIcon(loginIcon);
tupianLabel.setOpaque(true);
tupianLabel.setBackground(Color.GREEN);
tupianLabel.setPreferredSize(newDimension(260,60));
panel.add(tupianLabel,BorderLayout.NORTH);
//
setVisible(true);
setResizable(false);
//setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
publicstaticOperatergetUser(){
returnuser;
publicstaticvoidsetUser(Operateruser){
BookLoginIFrame.user=user;
需要这个图书馆管理系统素材和源码的小伙伴可以私信我领取,当然我不止有这点资料!