//注册页面
package com.gui;
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.ButtonUI;
import com.DateSystem.Userdate;
import java.awt.event.*;
import java.sql.*;
public class Register extends JFrame implements ActionListener,KeyListener ,FocusListener{
//注册组件
JLabel lbl_name,lbl_password,lbl_repassword,lbl_sex,lbl_id;//用户名,密码标签
JLabel lbl_post,lbl_phon,lbl_email,lbl_address;//地址之类的标签
JLabel lbl_name_tishi,lbl_password_tishi,lbl_repassword_tishi,lbl_sex_tishi,lbl_id_tishi;//提示标签
JTextField text_name,text_id,text_post,text_phon,text_email,text_address;//输入文本框
JPasswordField password,repassword;//密码的输入文本框
CheckboxGroup group ;
Checkbox sex_m;
Checkbox sex_w;
//JRadioButton sex_m,sex_w;
//ButtonGroup bg = new ButtonGroup();//分组用来制作单选框
JButton button_submit,button_exit;//按钮
JPanel jPanel;//装载容器
public Register() {
super("用户注册");
//标签组建的初始化
//用户基本信息
lbl_name = new JLabel("用 户 名:");
lbl_password = new JLabel("密 码:");
lbl_repassword = new JLabel("确认密码:");
lbl_sex = new JLabel("性 别:");
lbl_id = new JLabel("身份证号:");
//详细信息
lbl_post = new JLabel("职 位:");
lbl_phon = new JLabel("手 机 号:");
lbl_email = new JLabel("E ― mail:");
lbl_address = new JLabel("住 址:");
//提示信息
lbl_name_tishi = new JLabel("请输入您的真实姓名!");
lbl_password_tishi = new JLabel("请输入密码!");
lbl_repassword_tishi = new JLabel("两次输入不一样,请重新输入!");
lbl_sex_tishi=new JLabel("请选择性别!");
lbl_id_tishi=new JLabel("请填写您的身份证号!");
//输入框组件的初始化
//基本信息输入框
text_name = new JTextField();
password = new JPasswordField();
repassword = new JPasswordField();
//详细信息输入框
text_id = new JTextField();
text_post = new JTextField();
text_phon = new JTextField();
text_email = new JTextField();
text_address = new JTextField();
//性别组件
group = new CheckboxGroup();
sex_m = new Checkbox("男",group,true);
sex_w = new Checkbox("女",group,false);
//按钮组件的初始化
button_submit = new JButton("提交");
button_exit = new JButton("取消");
//设置字体,自号
Font font = new Font("Serif",Font.BOLD,18);
//向容器添加组件
jPanel = new JPanel();//创建容器
jPanel.setLayout(null);
//设置组件布局,我这里用的是坐标,因为这样界面会整齐些
lbl_name.setBounds(50, 50,90,20);
lbl_password.setBounds(50,80,90,20);
lbl_repassword.setBounds(50,110,90,20);
lbl_sex.setBounds(50,140,90,20);
lbl_id.setBounds(50,170,90, 20);
lbl_post.setBounds(50, 230, 90, 20);
lbl_phon.setBounds(50, 260, 90, 20);
lbl_email.setBounds(50, 290, 90, 20);
lbl_address.setBounds(50,320,90,20);
//输入框组件的添加
text_name.setBounds(150, 50,200,20);
password.setBounds(150,80,200,20);
repassword.setBounds(150,110,200,20);
sex_m.setBounds(170,140,40,20);//性别选择框
sex_w.setBounds(270, 140,40,20);
text_id.setBounds(150,170,200,20);
text_post.setBounds(150, 230, 200, 20);
text_phon.setBounds(150,260,200,20);
text_email.setBounds(150,290,200,20);
text_address.setBounds(150,320,200,20);
button_submit.setBounds(150,370,90,30);
button_exit.setBounds(300,370,90,30);
//提示组件添加
//lbl_name_tishi.setBounds(360, 50,200,20);
//lbl_password_tishi.setBounds(360,80,200,20);
//lbl_repassword_tishi.setBounds