谁有JAVA窗口运行代码?可以给我吗?就是一个登陆窗口的代码 格式写好哦 我是JAVA菜鸟

[复制链接]
查看11 | 回复3 | 2011-11-10 12:50:44 | 显示全部楼层 |阅读模式
packageview.frame;
importjava.awt.FlowLayout;
importjava.awt.GridLayout;importjavax.swing.BorderFactory;
importjavax.swing.ImageIcon;
importjavax.swing.JButton;
importjavax.swing.JComboBox;
importjavax.swing.JFrame;
importjavax.swing.JLabel;
importjavax.swing.JPanel;
importjavax.swing.JPasswordField;
importjavax.swing.JTextField;
importjavax.swing.UIManager;
importjavax.swing.UnsupportedLookAndFeelException;importview.commom.WindowCenter;
importvo.Admin;
importcontrol.user.UserConfirmAction;
publicclassUserLogonextendsJFrame{
privateJTextFieldjtfName,jtfId;
privateJPasswordFieldjpfPassword;
privateJComboBoxjcbUserType;
FlowLayoutfl=newFlowLayout(FlowLayout.CENTER,10,10);
publicstaticvoidmain(String[]args){
newUserLogon().setVisible(true);
}
publicUserLogon(){
this.setTitle(\"公司人事管理系统\");
this.add(getNorthPanel(),\"North\");
this.add(getMainPanel());
this.add(getButtonPanel(),\"South\");
this.setResizable(false);
//this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setBounds(500,500,335,410);
WindowCenter.centerWindow(this);
}
publicJLabelgetLabel(Stringtext){
JLabeljl=newJLabel(text);
returnjl;
}
publicAdmingetAdmin(){
returnnewAdmin(jtfName.getText().trim(),jtfId.getText().trim(),
newString(jpfPassword.getPassword()),jcbUserType.getSelectedItem().toString());
}
publicJButtongetJButton(Stringtext,Stringimage){
JButtonjb=newJButton(text,newImageIcon(image));
UserConfirmActionuca=newUserConfirmAction(this);
jb.addActionListener(uca);
returnjb;
}
publicJTextFieldgetJtfName(){
if(jtfName==null){
jtfName=newJTextField(12);
}
returnjtfName;
}
publicJTextFieldgetJtfId(){
if(jtfId==null){
jtfId=newJTextField(12);
}
returnjtfId;
}
publicJPasswordFieldgetJpfPassword(){
if(jpfPassword==null){
jpfPassword=newJPasswordField();
}
returnjpfPassword;
}
publicJComboBoxgetJcbUserType(){
if(jcbUserType==null){
Strings[]={\"系统管理员\",\"管理员\",\"员工\"};
jcbUserType=newJComboBox(s);
}
returnjcbUserType;
}
publicJPanelgetNorthPanel(){
JPaneljp=newJPanel();
JLabeljl=newJLabel(newImageIcon(\"icons/登陆注册界面/welcome.jpg\"));
//Fontf=newFont(\"\",Font.BOLD,18);
//jl.setFont(f);
//jl.setForeground(Color.RED);
jp.add(jl);
returnjp;
}
publicJPanelgetLabelPanel(){
JPaneljp=newJPanel();
jp.setLayout(newGridLayout(4,1,5,14));
jp.add(getLabel(\"用户名称:\"));
jp.add(getLabel(\"用户密码:\"));
jp.add(getLabel(\"用户编号:\"));
jp.add(getLabel(\"用户类型:\"));
returnjp;
}
publicJPanelgetTextlPanel(){
JPaneljp=newJPanel();
jp.setLayout(newGridLayout(4,1,5,10));
jp.add(getJtfName());
jp.add(getJpfPassword());
jp.add(getJtfId());
jp.add(getJcbUserType());
returnjp;
}publicJPanelgetMainPanel(){
JPaneljp=newJPanel();
jp.setLayout(fl);
jp.add(getLabelPanel());
jp.add(getTextlPanel());
jp.setBorder(BorderFactory
.createTitledBorder(null,\"请您正确输入登录信息.......\"));
returnjp;
}
publicJPanelgetButtonPanel(){
JPaneljp=newJPanel();
//jp.setLayout(fl);
jp.add(getJButton(\"登录注册\",\"icons/登陆注册界面/登入注册.png\"));
jp.add(getJButton(\"确定\",\"icons/登陆注册界面/登陆按钮.png\"));
JButtonjb=getJButton(\"退出\",\"icons/登陆注册界面/退出按钮.png\");
jp.add(jb);
returnjp;
}}
回复

使用道具 举报

千问 | 2011-11-10 12:50:44 | 显示全部楼层
提问人的追问
                               
                                2011-09-2910:38
                       
                        嗯很全面我在发一题你帮我写一下代码注释给五十分
回复

使用道具 举报

千问 | 2011-11-10 12:50:44 | 显示全部楼层

回复

使用道具 举报

千问 | 2011-11-10 12:50:44 | 显示全部楼层
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行