⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newuser.java

📁 宠物医院管理系统 包含宠物的注册 管理 收费 诊断等一系列过程控制 还包含配应的数据库 Jar包
💻 JAVA
字号:
package yd.pethosptial.usermanager.view;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import yd.pethospital.usermanager.jdbc.NewUserGet;

public class NewUser extends JFrame{
	
	JLabel LNum,LName,LPassword,LLevel;                  //标签:用户编号、用户名称、密码、用户级别
	public static Choice CLevel;                       //用户级别选项
	public static JTextField TNum,TName,TPassword,TLevel;  //文本:用户编号、用户名称、密码
	JButton BSure,BCancel;
	
	public NewUser(){	
		
		this.setTitle("新增用户");                          //设置窗体标题、空布局、位置大小、不可更改大小
		this.setLayout(null);
		this.setBounds(350, 200, 300, 300);
		this.setResizable(false);
		this.validate();
		
		LNum=new JLabel("用户编号");                               //设置标签:用户编号
		LNum.setBounds(30, 20, 80, 20);
		LNum.setFont(new Font(null,Font.BOLD,16));
		this.add(LNum);
		
		LName=new JLabel("用户名称");                              //设置标签:用户名称
		LName.setBounds(30, 60, 80, 20);
		LName.setFont(new Font(null,Font.BOLD,16));
		this.add(LName);
		
		LPassword=new JLabel("密      码");                        //设置标签:密码
		LPassword.setBounds(30, 100, 80, 20);
		LPassword.setFont(new Font(null,Font.BOLD,16));
		this.add(LPassword);
		
		LLevel=new JLabel("用户级别");                             //设置标签:用户级别
		LLevel.setBounds(30, 140, 80, 20);
		LLevel.setFont(new Font(null,Font.BOLD,16));
		this.add(LLevel);
		
		TNum=new JTextField(20);                                  //设置文本:用户编号
		TNum.setBounds(130, 20, 130, 25);
		TNum.setFont(new Font(null,Font.BOLD,16));
		this.add(TNum);
		
		TName=new JTextField(20);                                  //设置文本:用户名称
		TName.setBounds(130, 60, 130, 25);
		TName.setFont(new Font(null,Font.BOLD,16));
		this.add(TName);
		
		TPassword=new JTextField(20);                              //设置文本:密码
		TPassword.setBounds(130, 100, 130, 25);
		TPassword.setFont(new Font(null,Font.BOLD,16));
		this.add(TPassword);
		
		CLevel=new Choice();                                       //设置级别下拉列表
		
			CLevel.addItem("管理员");
			CLevel.addItem("负责人");
			CLevel.addItem("业务员");
			CLevel.addItem("收费员");
		CLevel.setBounds(130, 140, 130, 25)	;
		this.add(CLevel);
		
		BSure=new JButton("确定");                                 //确定按钮
		BSure.setBounds(70, 200, 60, 30);
		BSure.setFont(new Font(null,Font.BOLD,12));
		this.add(BSure);
		
		 BSure.addActionListener(new ActionListener(){            //确定监听器

			   public void actionPerformed(ActionEvent arg0) {
				   
				   new NewUserGet(NewUser.this);
			   }
		 });
		
		BCancel=new JButton("取消");                               //取消按钮
		BCancel.setBounds(180, 200, 60, 30);
		BCancel.setFont(new Font(null,Font.BOLD,12));
		this.add(BCancel);
		
		 BCancel.addActionListener(new ActionListener(){           //取消监听器

			   public void actionPerformed(ActionEvent arg0) {
				
				   NewUser.this.dispose();
				   new UserManager();
			   }
		   });
		 
		this.setVisible(true);                                    //设置窗体可视化
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -