📄 changeprotect.java
字号:
package yd.pethospital.protectregister.view;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import yd.pethospital.protectcommom.ChangeProtectGet;
public class ChangeProtect extends JFrame{
JLabel LNum,LDate,LMedicine,LAccount,LMan; //标签:编号、接种日期、疫苗、数量、接种人
public static JTextField TNum,TDate,TMedicine,TAccount,TMan; //文本:编号、接种日期、疫苗、数量、接种人
JButton BSure,BCancel;
public ChangeProtect(){
this.setTitle("修改防疫"); //设置窗体标题、不可更改大小、位置大小、空布局
this.setResizable(false);
this.setBounds(400, 150, 310, 320);
this.setLayout(null);
this.validate();
LNum=new JLabel("宠物编号"); //设置宠物编号 位置大小 字体
LNum.setBounds(30,15,70,50);
LNum.setFont(new Font(null,Font.BOLD,15));
this.add(LNum);
LDate=new JLabel("接种日期"); //设置接种日期 位置大小 字体
LDate.setBounds(30,50,70,50);
LDate.setFont(new Font(null,Font.BOLD,15));
this.add(LDate);
LMedicine=new JLabel("疫苗编号"); //设置疫苗编号 位置大小 字体
LMedicine.setBounds(30,85,70,50);
LMedicine.setFont(new Font(null,Font.BOLD,15));
this.add(LMedicine);
LAccount=new JLabel("使用数量"); //设置使用数量 位置大小 字体
LAccount.setBounds(30,120,70,50);
LAccount.setFont(new Font(null,Font.BOLD,15));
this.add(LAccount);
LMan=new JLabel("接 种 人"); //设置接种人 位置大小 字体
LMan.setBounds(30,155,80,50);
LMan.setFont(new Font(null,Font.BOLD,15));
this.add(LMan);
TNum=new JTextField(20); //设置编号文本 位置大小 不可编辑
TNum.setBounds(115,25,110,25);
TNum.setEditable(false);
this.add(TNum);
TDate=new JTextField(20); //设置接种日期 位置大小
TDate.setBounds(115,60,110,25);
this.add(TDate);
TMedicine=new JTextField(50); //设置疫苗编号 位置大小
TMedicine.setBounds(115,95,110,25);
this.add(TMedicine);
TAccount=new JTextField(50); //设置使用数量 位置大小
TAccount.setBounds(115,130,110,25);
this.add(TAccount);
TMan=new JTextField(50); //设置诊断人 位置大小
TMan.setBounds(115,165,110,25);
this.add(TMan);
BSure=new JButton("确定"); //设置 确定 按钮
BSure.setBounds(30,220,60,25);
this.add(BSure);
BCancel=new JButton("取消"); //设置 取消 按钮
BCancel.setBounds(130,220,60,25);
this.add(BCancel);
BSure.addActionListener(new ActionListener(){ //添加确定按钮监听器
public void actionPerformed(ActionEvent e) {
new ChangeProtectGet(ChangeProtect.this);
}
});
BCancel.addActionListener(new ActionListener(){ //添加取消按钮监听器
public void actionPerformed(ActionEvent e) {
ChangeProtect.this.dispose();
new ProtectRegister();
}
});
this.setVisible(true); //设置窗体可视性
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -