j**a窗口程序制作

时间:2013.06.17 发布人:cswg9621

j**a窗口程序制作

已解决问题

谷歌cswg9621用户在2013.06.17提交了关于“绝命师j**a窗口程序制作”的提问,欢迎大家涌跃发表自己的观点。目前共有1个回答,最后更新于2024-07-31T20:17:10。j**a小程序设计,设计一个3窗口程序
嗯.登陆界面(帐号.密码.这些.如果能有验码的话)
注册界面(帐号.姓名.密码.邮箱)
登陆失败提示遗迹登陆成功界面(帐号.姓名.密码.邮箱)这些的说
的说.
回答加分的说~~~~~~~~~~~~我们后天交的说
麻烦了的说希望大家能够帮助她。

详细问题描述及疑问:j**a小程序设计,设计一个3窗口程序
嗯.登陆界面(帐号.密码.这些.如果能有验码的话)
注册界面(帐号.姓名.密码.邮箱)
登陆失败提示遗迹登陆成功界面(帐号.姓名.密码.邮箱)这些的说
的说.
回答加分的说~~~~~~~~~~~~我们后天交的说
麻烦了的说期待您的答案,你是我的宝贝,你是我的花,谢谢你对我的帮助!

希望以下的回答,能够帮助你。

第1个回答

用户名: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**);
}

}这个是登录界面的代码的说