用户名:su2010000
不知道你要连什么**库的说.
硬性规定要用**库的么,要是要的话,你可以自己改改下面的代码的说.
importj**a.awt.FlowLayout;
importj**a.awt.GridBagConstraints伤据院婷是江继;
importj**a.awt.GridBagLayout;
importj**a.awt.Point;
importj**来自a.awt.event.问答ActionEvent;
importj**a.a举达甲笔蛋船供展带身王wt.event.Actio抓知国矛马稳火末口尼nListener;
importj**ax.swing.JBut帝虽谁依村坚殖倍ton;
importj**ax.swing.JFrame;
import肥动专j**ax.swing.JLabel;
importja点货只化营业取阳vax.swing.JOptionPane;
importj**ax.swing.JPanel;
importj**a源杆满括x.swing.JPasswordField;
importj**ax.swing.JTextField;
publicclassLoginFrameextendsJFrame{
/**
*serialVersionUID.
*/
p话守地不要识手rivatestaticfinallongser它历白值轮ialVersionUID=1589516151强过31406887L;
privateJLabeluserName=newJLabel("用户名:");
privateJTextFielduserNameField=newJTextField(10);
privateJLabelpassword=ne春短英凯计拿调把wJLabel("密码:");
privateJP员唱斤报asswordFieldpasswordField=newJPasswordField(10);
privateJButtonloginBu除tton=newJButton("登录");
privateJButtonregister=完反战newJButton("注册");
privateJPanelpanel=newJPanel();
publicLoginFrame(Stringname,Pointp){
supe段族r(name);
setLocation(p);
GridBagLayoutlayout=newGridBagLayout();
GridBagConstraintsconstra其班项却支居态念套完ints=newGridBagConstraints();
panel.setLayout(l黄加ayout);
constraints.fill造验分外=GridBagConstraints.BOTh**;
constraints.weightx=1.0;
layout.setConstraints(userName,constraints);
constraints.gridwidth=GridBagConstraints.REMAINDER;
layout.setConstraints(userNameField,constraints);
constraints.gridwidth=GridBagConstraints.RELATIVE;
layout.setConstraints(password,constraints);
constraints.gridwidth=GridBagConstraints.REMAINDER;
layout.setConstraints(passwordField,constraints);
panel.add(userName);
panel.add(userNameField);
panel.add(password);
panel.add(passwordField);
panel.add(loginButton);
panel.add(register);
loginButton.addActionListener(newActionListener(){
publicvoidactionPerformed(ActionEvente){
Stringusername=userNameField.getText();
char[]passwordStrAry=passwordField.getPassword();
Stringpassword=passwordStrAry!=**ll?newString(
passwordStrAry):**ll;
if(username==**ll||password==**ll||"".equals(username)
||"".equals(password)){
JOptionPane.showMessageDialog(**ll,"密码和用户名不能为空","注意",
JOptionPane.ERROR_MESSAGE);
if(username==**ll||"".equals(username))
userNameField.grabFocus();
else
passwordField.grabFocus();
return;
}
booleancheckResult=UserManager
.loginCheck(username,password);
if(!checkResult){
JOptionPane.showMessageDialog(**ll,"密码或用户名不正确","注意",
JOptionPane.ERROR_MESSAGE);
}else{
newMessageFrame("登录成功,欢迎光临!",getLocation());
dispose();
}
}
});
register.addActionListener(newActionListener(){
@Override
publicvoidactionPerformed(ActionEvente){
newRegisterFrame("注册界面",getLocation());
dispose();
}
});
setLayout(newFlowLayout());
add(panel);
setSize(250,130);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLO**);
}
}这个是登录界面的代码的说