📄 useradd.java
字号:
import java.awt.*;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Rectangle;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import java.awt.Color;
import javax.swing.DebugGraphics;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2008</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class UserAdd extends JFrame {
public UserAdd() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
getContentPane().setLayout(null);
this.setForeground(Color.black);
this.setTitle("添加用户");
jLabel1.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 24));
jLabel1.setText("用户名");
jLabel1.setBounds(new Rectangle(34, 80, 78, 23));
jTextField1.setFont(new java.awt.Font("宋体", Font.PLAIN, 22));
jTextField1.setBounds(new Rectangle(129, 80, 130, 27));
jTextField1.addActionListener(new UserAdd_jTextField2_actionAdapter(this));
jLabel2.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 24));
jLabel2.setText("密码");
jLabel2.setBounds(new Rectangle(51, 120, 58, 26));
jLabel3.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 22));
jLabel3.setText("确认密码");
jLabel3.setBounds(new Rectangle(29, 157, 92, 30));
jLabel4.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 22));
jLabel4.setText("登录权限");
jLabel4.setBounds(new Rectangle(32, 203, 88, 26));
jComboBox1.setToolTipText("");
jComboBox1.setSelectedItem(null);
jComboBox1.setBounds(new Rectangle(129, 200, 135, 27));
jComboBox1.addActionListener(new UserAdd_jComboBox1_actionAdapter(this));
jLabel5.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 36));
jLabel5.setForeground(new Color(158, 72, 118));
jLabel5.setBorder(BorderFactory.createLoweredBevelBorder());
jLabel5.setDebugGraphicsOptions(0);
jLabel5.setActionMap(null);
jLabel5.setDisabledIcon(null);
jLabel5.setIcon(null);
jLabel5.setText("用 户 注 册 ");
jLabel5.setBounds(new Rectangle(14, 6, 368, 60));
jPasswordField1.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 22));
jPasswordField1.setBounds(new Rectangle(129, 120, 130, 27));
jPasswordField2.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 22));
jPasswordField2.setBounds(new Rectangle(129, 161, 130, 26));
jButton1.setBounds(new Rectangle(283, 106, 95, 43));
jButton1.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 26));
jButton1.setText("确定");
jButton2.setBounds(new Rectangle(283, 183, 94, 43));
jButton2.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 26));
jButton2.setText("取消");
this.getContentPane().add(jLabel1);
this.getContentPane().add(jLabel2);
this.getContentPane().add(jTextField1);
this.getContentPane().add(jLabel5);
this.getContentPane().add(jPasswordField1);
this.getContentPane().add(jButton1);
this.getContentPane().add(jButton2);
this.getContentPane().add(jPasswordField2);
this.getContentPane().add(jLabel3);
this.getContentPane().add(jLabel4);
this.getContentPane().add(jComboBox1);
}
public static void main(String[] args) {
UserAdd useradd = new UserAdd();
}
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JTextField jTextField1 = new JTextField();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JComboBox jComboBox1 = new JComboBox();
JLabel jLabel5 = new JLabel();
JPasswordField jPasswordField1 = new JPasswordField();
JPasswordField jPasswordField2 = new JPasswordField();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
public void jTextField2_actionPerformed(ActionEvent e) {
}
public void jComboBox1_actionPerformed(ActionEvent e) {
String Item[]={"———— 请选择 ————","超级管理员","普通管理员","普通用户"};
jComboBox1=new JComboBox(Item);
}
}
class UserAdd_jComboBox1_actionAdapter implements ActionListener {
private UserAdd adaptee;
UserAdd_jComboBox1_actionAdapter(UserAdd adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jComboBox1_actionPerformed(e);
}
}
class UserAdd_jTextField2_actionAdapter implements ActionListener {
private UserAdd adaptee;
UserAdd_jTextField2_actionAdapter(UserAdd adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jTextField2_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -