
Java注册界面设计。
5星
- 浏览量: 0
- 大小:None
- 文件类型:None
简介:
public class Registration {
public Registration() {
RegistrationFrame registration = new RegistrationFrame();
registration.setVisible(true);
}
public static void main(String[] args) {
new Registration();
}
}
class RegistrationFrame extends JFrame {
// 框架类
private Toolkit toolkit; // Abstract Window Toolkit 的所有实际实现的抽象超类 查询 API
public RegistrationFrame() {
setTitle(用户注册);
toolkit = Toolkit.getDefaultToolkit();
Dimension screenDimension = toolkit.getScreenSize();
int windowWidth = screenDimension.width;
int windowHeight = screenDimension.height;
setBounds((windowWidth - 300) / 2, (windowHeight - 300) / 2, 300, 400);
setResizable(false);
RegistrationPanel registrationPanel = new RegistrationPanel(this);
add(registrationPanel);
}
}
class RegistrationPanel extends JPanel implements ActionListener {
// 容器类
private JLabel titleLabel, nameLabel, passwordLabel1, passwordLabel2, sexLabel, ageLabel, classLabel, interestLabel;
private JTextField nameField, ageField;
private JPasswordField passwordField1, passwordField2;
private JButton submitButton, resetButton, cancelButton;
private JRadioButton radioButton1, radioButton2; // 添加了radioButton变量声明,便于后续使用。如果未在代码中定义,则需要添加定义。这里仅为确保代码完整性。
private JCheckBox[] checkBoxArray = {new JCheckBox(电脑), new JCheckBox(音乐), new JCheckBox(旅游), new JCheckBox(购物), new JCheckBox(运动), new JCheckBox(其他)}; // 添加了checkBox变量声明,便于后续使用。如果未在代码中定义,则需要添加定义。这里仅为确保代码完整性。
private Vector
全部评论 (0)


