import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.awt.event.*;
public class Register extends JFrame implements ActionListener,KeyListener,ItemListener {
private JLabel nameLabel;
private JLabel secretLabel1;
private JLabel secretLabel2;
private JButton cancel;
private JButton ok;
private JTextField nameText;
private JPasswordField secretText1;
private JPasswordField secretText2;
private Container c;
private JLabel jphone;
private JTextField tphone;
private JLabel jaddress;
private JTextField taddress;
private JLabel jfax;
private JTextField tfax;
private JLabel must;
private JLabel must1;
private JLabel must2;
private JLabel free;
java.sql.Connection con;
private JLabel jproveince;
JComboBox proveinceComboBox;
private JLabel jcity;
JComboBox cityComboBox;
String[] provinceid = new String[33] ;
String[] provincename = new String[33];
String[] cityid = new String[367];
String[] cityname= new String[367];
public Register(){
super("用户注册");
c = this.getContentPane();
c.setLayout(new BorderLayout());
provinceid[0] = "2";
provincename[0] = "北京";
provinceid[1] = "20";
provincename[1] = "安徽";
provinceid[2] = "23";
provincename[2] = "福建";
provinceid[3] = "33";
provincename[3] = "甘肃";
provinceid[4] = "48";
provincename[4] = "广东";
provinceid[5] = "70";
provincename[5] = "广西";
provinceid[6] = "85";
provincename[6] = "贵州";
provinceid[7] = "95";
provincename[7] = "海南";
provinceid[8] = "114";
provincename[8] = "河北";
provinceid[9] = "126";
provincename[9] = "河南";
provinceid[10] = "145";
provincename[10] = "黑龙江";
provinceid[11] = "159";
provincename[11] = "湖北";
provinceid[12] = "177";
provincename[12] = "湖南";
provinceid[13] = "192";
provincename[13] = "吉林";
provinceid[14] = "202";
provincename[14] = "江苏";
provinceid[15] = "216";
provincename[15] = "江西";
provinceid[16] = "228";
provincename[16] = "辽宁";
provinceid[17] = "243";
provincename[17] = "内蒙古";
provinceid[18] = "256";
provincename[18] = "宁夏";
provinceid[19] = "261";
provincename[19] = "青海";
provinceid[20] = "270";
provincename[20] = "山东";
provinceid[21] = "288";
provincename[21] = "山西";
provinceid[22] = "300";
provincename[22] = "陕西";
provinceid[23] = "311";
provincename[23] = "上海";
provinceid[24] = "314";
provincename[24] = "四川";
provinceid[25] = "336";
provincename[25] = "天津";
provinceid[26] = "339";
provincename[26] = "西藏";
provinceid[27] = "347";
provincename[27] = "新疆";
provinceid[28] = "364";
provincename[28] = "云南";
provinceid[29] = "381";
provincename[29] = "浙江";
provinceid[30] = "393";
provincename[30] = "重庆";
provinceid[31] = "396";
provincename[31] = "港,澳";
provinceid[32] = "399";
provincename[32] = "台湾";
/////////////////////////////////
nameLabel = new JLabel(" 帐号名称 ");
secretLabel1 = new JLabel(" 请输入密码 ");
secretLabel2 = new JLabel(" 请确认密码 ");
cancel = new JButton("取消");
ok = new JButton("确定");
nameText = new JTextField(10);
secretText1 = new JPasswordField(10);
secretText2 = new JPasswordField(10);
jphone = new JLabel(" 电话号码 ");
tphone = new JTextField(10);
jfax = new JLabel(" 传真号码 ");
tfax = new JTextField(10);
must = new JLabel(" *必填");
must1 = new JLabel(" *必填");
must2 = new JLabel(" *必填");
free = new JLabel(" *选填");
jaddress = new JLabel(" 详细地址 ");
taddress = new JTextField(10);
jproveince = new JLabel (" 省 ");
proveinceComboBox = new JComboBox(provincename);
proveinceComboBox.addItemListener(this);
jcity = new JLabel (" 市 ");
cityComboBox = new JComboBox(new String[]{"北京市区","北京郊区"});
// cityComboBox.setModel(new DefaultComboBoxModel());
////////
/////连接数据库///////
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
System.out.println("数据库驱动加载成功");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
con = DriverManager.getConnection
("jdbc:microsoft:sqlserver://localhost:1433;" +
"DatabaseName=storage","sa","");
System.out.println("数据库连接成功");
} catch (SQLException e) {
e.printStackTrace();
}
/////////////////////////////////
//用户界面信息板块
JPanel userInfoPanel = new JPanel(new GridLayout(7,1));
JPanel namePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
namePanel.add(nameLabel);
namePanel.add(nameText);
namePanel.add(must);
JPanel textPanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
textPanel1.add(secretLabel1);
textPanel1.add(secretText1);
textPanel1.add(must);
JPanel textPanel2= new JPanel(new FlowLayout(FlowLayout.LEFT));
textPanel2.add(secretLabel2);
textPanel2.add(secretText2);
textPanel2.add(must);
JPanel phonePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
phonePanel.add(jphone);
phonePanel.add(tphone);
phonePanel.add(must);
JPanel addressPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
addressPanel.add(jaddress);
addressPanel.add(taddress);
addressPanel.add(must1);
JPanel regionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
regionPanel.add( jproveince );
regionPanel.add(proveinceComboBox);
regionPanel.add( jcity );
regionPanel.add(cityComboBox);
regionPanel.add(must2);
JPanel faxPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
faxPanel.add(jfax);
faxPanel.add(tfax);
faxPanel.add(free);
userInfoPanel.add(namePanel);
userInfoPanel.add(textPanel1);
userInfoPanel.add(textPanel2);
userInfoPanel.add(phonePanel);
userInfoPanel.add(regionPanel);
userInfoPanel.add(addressPanel);
userInfoPanel.add(faxPanel);
//连接板块
JPanel connectPanel = new JPanel(new GridLayout(1,3));
connectPanel.add(ok);
connectPanel.add(cancel);
////事件监听
secretText1.addKeyListener(this);
secretText2.addKeyListener(this);
nameText.addKeyListener(this);
//事件监听 按钮
cancel.addActionListener(this);
ok.addActionListener(this);
cancel.addKeyListener(this);
ok.addKeyListener(this);
//整合到最终面板
c.add(userInfoPanel,BorderLayout.NORTH);
c.add(connectPanel,BorderLayout.SOUTH);
this.setPreferredSize(new Dimension(300,360));//默认大小
this.setMaximumSize(new Dimension(300,360));//最大
this.setLocation(500,300);
this.pack(); //设置窗体的大小最适合里面内容
//this.setResizable(false); //设置不能最大化
this.setVisible(true);//设置可不可见
}
public void actionPerformed(ActionEvent e){
if(e.getSource() == cancel){
this.shutDown();
}
else if (e.getSource() == ok){
if ((nameText.getText()).trim().length() == 0){
//有助于方便地弹出要求用户提供值或向其发出通知的标准对话框。
JOptionPane.showMessageDialog(this,"请输入一个名字","提示",JOptionPane.INFORMATION_MESSAGE);
return;
}
else if((new String(secretText1.getPassword())).trim().length()==0){
JOptionPane.showMessageDialog(this,"请输入密码","提示",JOptionPane.INFORMATION_MESSAGE);
return;
}
else if((new String(secretText2.getPassword())).trim().length()==0){
JOptionPane.showMessageDialog(this,"请重复输入密码","提示",
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
ck.rar (96个子文件)
storage_Log.LDF 1024KB
ckfinal
操作日志.jpg 4KB
运输整合.jpg 3KB
bin
UserMessage$UpdateListener.class 611B
clientorder.class 7KB
In$1.class 669B
Insert.class 7KB
UserMessage$UserdeListener.class 690B
UserMessage$AddListener.class 602B
Userinfo$1.class 3KB
Help.class 3KB
Userinfo$UserdeListener.class 2KB
product_detail$1.class 730B
Out.class 6KB
main_window.class 5KB
clientorder$1.class 732B
TransportIntegration.class 10KB
user_main.class 3KB
In$3.class 3KB
Inout.class 3KB
Add$1.class 675B
product_detail.class 7KB
Add.class 7KB
Userinfo$CheckListener.class 2KB
Out$2.class 814B
clientorder$6.class 748B
test.class 323B
Help$1.class 585B
updateinfo.class 7KB
clientorder$5.class 859B
UserMessage.class 5KB
In$4.class 7KB
Userorder$1.class 719B
user_msupdate.class 10KB
product_detail$2.class 2KB
clientorder$3.class 865B
Add$dateListener.class 786B
In.class 6KB
Add$SureListener.class 5KB
In$2.class 808B
Userorder.class 5KB
UserMessage$CheckListener.class 608B
Userinfo$2.class 1KB
clientorder$2.class 908B
clientorder$7.class 5KB
Stocks.class 2KB
Userinfo$AddListener.class 584B
log.class 4KB
ResultSetTableModel.class 2KB
Add$2.class 3KB
Out$3.class 3KB
Out$4.class 5KB
Login$ItemActionListener.class 975B
Out$1.class 676B
Userorder$2.class 851B
Register.class 30KB
Add$ioListener.class 780B
Userorder$3.class 3KB
Login.class 9KB
Userinfo.class 5KB
clientorder$4.class 3KB
main1.jpg 77KB
出库管理.jpg 4KB
用户信息.jpg 3KB
帮助.jpg 3KB
src
Stocks.java 2KB
Insert.java 8KB
test.java 143B
Userinfo.java 9KB
UserMessage.java 4KB
log.java 4KB
Login.java 10KB
Add.java 11KB
Register.java 34KB
clientorder.java 16KB
main_window.java 7KB
Userorder.java 8KB
Help.java 3KB
TransportIntegration.java 11KB
product_detail.java 16KB
In.java 19KB
user_main.java 4KB
Out.java 14KB
User_product.java 7KB
Inout.java 3KB
user_msupdate.java 13KB
.project 383B
入库管理.jpg 3KB
库存管理.jpg 3KB
Thumbs.db 5KB
.classpath 232B
main.jpg 67KB
需求提交.jpg 3KB
用户管理.jpg 3KB
库存查询.jpg 3KB
storage_Data.MDF 1.44MB
共 96 条
- 1
刘良运
- 粉丝: 68
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论10