📄 register.java
字号:
package client;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.Toolkit;
import java.awt.Color;
import java.awt.Rectangle;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import java.awt.Font;
import java.awt.event.ActionEvent;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JTextField;
import javax.swing.JTextArea;
import javax.swing.JButton;
import javax.swing.JPasswordField;
import javax.swing.border.TitledBorder;
import javax.swing.border.SoftBevelBorder;
import javax.swing.SwingConstants;
public class Register extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JPanel jPanel = null;
private JPanel jPanel1 = null;
private JPanel jPanel2 = null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
private JLabel jLabel2 = null;
private JLabel jLabel3 = null;
private JLabel jLabel4 = null;
private JLabel jLabel7 = null;
private JLabel jLabel8 = null;
private JComboBox jComboBox = null;
private JTextField jTextField = null;
private JLabel jLabel9 = null;
private JTextField jTextField1 = null;
private JLabel jLabel10 = null;
private JComboBox jComboBox1 = null;
private JLabel jLabel11 = null;
private JComboBox jComboBox2 = null;
private JLabel jLabel12 = null;
public JTextField jTextField3 = null;
private JLabel jLabel16 = null;
private JLabel jLabel17 = null;
private JButton jButton = null;
private JButton jButton1 = null;
private JButton jButton2 = null;
private JLabel jLabel20 = null;
private JPasswordField jPasswordField = null;
private JTextField jTextField4 = null;
private Login login = null;
private JPanel jPanel3 = null;
private JTextArea jTextArea = null;
private Controller controller = null;
private JPasswordField jPasswordField1 = null;
private Portrait portrait = null;
/**
* This is the default constructor
*/
public Register(Login login, Controller controller) {
super();
initialize();
this.login = login;
this.controller = controller;
// register = this;
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setResizable(false);
this.setBounds(new Rectangle(250, 150, 568, 376));
this.setForeground(new Color(169, 213, 244));
this.setIconImage(Toolkit.getDefaultToolkit().getImage(
getClass().getResource("/picture/1108.gif")));
this.setContentPane(getJContentPane());
this.setTitle("QQ注册");
this.setVisible(true);
this.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
Register.this.dispose();
login.setVisible(true);
}
});
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setForeground(new Color(169, 213, 244));
jContentPane.setBackground(new Color(169, 213, 244));
jContentPane.add(getJPanel(), null);
jContentPane.add(getJPanel1(), null);
jContentPane.add(getJButton(), null);
jContentPane.add(getJButton1(), null);
jContentPane.add(getJButton2(), null);
}
return jContentPane;
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
jLabel20 = new JLabel();
jLabel20.setBounds(new Rectangle(2, 0, 156, 300));
jLabel20.setIcon(new ImageIcon(getClass().getResource(
"/picture/08TRxbXEsbO+sA==_T9zjI4gq5fHA.jpg")));
jLabel20.setForeground(new Color(140, 164, 252));
jLabel20.setBackground(new Color(140, 164, 252));
jLabel20.setText("");
jPanel = new JPanel();
jPanel.setLayout(null);
jPanel.setBounds(new Rectangle(4, 1, 160, 302));
jPanel.setBorder(BorderFactory.createLineBorder(new Color(118, 171,
211), 1));
jPanel.setBackground(new Color(246, 246, 244));
jPanel.add(jLabel20, null);
}
return jPanel;
}
/**
* This method initializes jPanel1
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel1() {
if (jPanel1 == null) {
jLabel17 = new JLabel();
jLabel17.setFont(new Font("Dialog", Font.PLAIN, 12));
jLabel17.setForeground(new Color(51, 51, 255));
jLabel17.setBounds(new Rectangle(292, 93, 55, 18));
jLabel17.setText("更改头像");
jLabel17
.addMouseMotionListener(new java.awt.event.MouseMotionListener() {
public void mouseMoved(java.awt.event.MouseEvent e) {
jLabel17.setForeground(Color.red);
}
public void mouseDragged(java.awt.event.MouseEvent e) {
}
});
jLabel17.addMouseListener(new java.awt.event.MouseListener() {
public void mouseClicked(java.awt.event.MouseEvent e) {
Register.this.setEnabled(false);
if (portrait == null) {
portrait = new Portrait(Register.this);
}
portrait.setVisible(true);
}
public void mouseExited(java.awt.event.MouseEvent e) {
jLabel17.setForeground(new Color(51, 51, 255));
}
public void mousePressed(java.awt.event.MouseEvent e) {
}
public void mouseReleased(java.awt.event.MouseEvent e) {
}
public void mouseEntered(java.awt.event.MouseEvent e) {
}
});
jLabel16 = new JLabel();
jLabel16.setIcon(new ImageIcon(getClass().getResource(
"/picture/18.gif")));
jLabel16.setBounds(new Rectangle(292, 42, 56, 50));
jLabel16.setHorizontalAlignment(SwingConstants.TRAILING);
jLabel16.setVerticalAlignment(SwingConstants.CENTER);
jLabel16.setHorizontalTextPosition(SwingConstants.TRAILING);
jLabel16.setText("18.gif");
jLabel12 = new JLabel();
jLabel12.setFont(new Font("Dialog", Font.PLAIN, 12));
jLabel12.setBounds(new Rectangle(220, 244, 30, 24));
jLabel12.setText("生日:");
jLabel11 = new JLabel();
jLabel11.setFont(new Font("Dialog", Font.PLAIN, 12));
jLabel11.setBounds(new Rectangle(115, 244, 36, 24));
jLabel11.setText("血型:");
jLabel10 = new JLabel();
jLabel10.setFont(new Font("Dialog", Font.PLAIN, 12));
jLabel10.setBounds(new Rectangle(5, 244, 34, 24));
jLabel10.setText("生肖:");
jLabel9 = new JLabel();
jLabel9.setFont(new Font("Dialog", Font.PLAIN, 12));
jLabel9.setBounds(new Rectangle(220, 208, 30, 24));
jLabel9.setText("姓名:");
jLabel8 = new JLabel();
jLabel8.setFont(new Font("Dialog", Font.PLAIN, 12));
jLabel8.setBounds(new Rectangle(117, 208, 30, 24));
jLabel8.setText("年龄:");
jLabel7 = new JLabel();
jLabel7.setFont(new Font("Dialog", Font.PLAIN, 12));
jLabel7.setBounds(new Rectangle(5, 208, 34, 23));
jLabel7.setText("性别:");
jLabel4 = new JLabel();
jLabel4.setFont(new Font("Dialog", Font.PLAIN, 12));
jLabel4.setBounds(new Rectangle(5, 112, 65, 22));
jLabel4.setText("确认密码:");
jLabel3 = new JLabel();
jLabel3.setFont(new Font("Dialog", Font.PLAIN, 12));
jLabel3.setBounds(new Rectangle(5, 79, 65, 22));
jLabel3.setText("密码:");
jLabel2 = new JLabel();
jLabel2.setFont(new Font("Dialog", Font.PLAIN, 12));
jLabel2.setBounds(new Rectangle(5, 50, 65, 22));
jLabel2.setText("呢称:");
jPanel1 = new JPanel();
jPanel1.setLayout(null);
jPanel1.setBounds(new Rectangle(170, 2, 385, 301));
jPanel1.setBackground(Color.white);
jPanel1.setBorder(BorderFactory.createLineBorder(new Color(118,
171, 211), 1));
jPanel1.add(getJPanel2(), null);
jPanel1.add(jLabel2, null);
jPanel1.add(jLabel3, null);
jPanel1.add(jLabel4, null);
jPanel1.add(jLabel7, null);
jPanel1.add(jLabel8, null);
jPanel1.add(getJComboBox(), null);
jPanel1.add(getJTextField(), null);
jPanel1.add(jLabel9, null);
jPanel1.add(getJTextField1(), null);
jPanel1.add(jLabel10, null);
jPanel1.add(getJComboBox1(), null);
jPanel1.add(jLabel11, null);
jPanel1.add(getJComboBox2(), null);
jPanel1.add(jLabel12, null);
jPanel1.add(getJTextField3(), null);
jPanel1.add(jLabel16, null);
jPanel1.add(jLabel17, null);
jPanel1.add(getJPasswordField(), null);
jPanel1.add(getJTextField4(), null);
jPanel1.add(getJPanel3(), null);
jPanel1.add(getJPasswordField1(), null);
}
return jPanel1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -