📄 newbacteria.java
字号:
package yd.pethospital.bacteriaregister.view;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import yd.pethospital.bacteriaregister.jdbc.NewBacteriaGet;
public class NewBacteria extends JFrame{
JLabel LNum,LName,LType,LAttention; //标签:疫苗编号、疫苗名称、疫苗类型、注意事项
public static JTextField TNum,TName,TAttention; //文本:疫苗编号、疫苗名称、注意事项
public static Choice CType; //选择:类型
JButton BSure,BCancel;
public NewBacteria(){
this.setTitle("新增疫苗信息"); //设置窗体:标题 不可更改大小 空布局 位置大小
this.setResizable(false);
this.setLayout(null);
this.setBounds(200, 200, 460, 300);
this.validate();
LNum = new JLabel("疫苗编号"); //设置标签:疫苗编号
LNum.setBounds(30,20,80,50);
LNum.setFont(new Font(null,Font.BOLD,15));
this.add(LNum);
LName=new JLabel("疫苗名称"); //设置标签:疫苗名称
LName.setBounds(30,60,80,50);
LName.setFont(new Font(null,Font.BOLD,15));
this.add(LName);
LType=new JLabel("疫苗类型"); //设置标签:疫苗类型
LType.setBounds(30,100,80,50);
LType.setFont(new Font(null,Font.BOLD,15));
this.add(LType);
LAttention=new JLabel("注意事项"); //设置标签:注意事项
LAttention.setBounds(30,140,70,50);
LAttention.setFont(new Font(null,Font.BOLD,15));
this.add(LAttention);
TNum=new JTextField(20); //设置文本:疫苗编号
TNum.setBounds(120, 35, 150, 25);
TNum.setFont(new Font(null,Font.BOLD,14));
this.add(TNum);
TName=new JTextField(30); //设置文本:疫苗名称
TName.setBounds(120, 75, 180, 25);
TName.setFont(new Font(null,Font.BOLD,14));
this.add(TName);
CType=new Choice(); //疫苗类型
CType.addItem("多种动物用灭活疫苗");
CType.addItem("马牛羊用灭活疫苗");
CType.addItem("猪用灭活疫苗");
CType.addItem("禽用灭活疫苗");
CType.addItem("其它动物用灭活疫苗");
CType.addItem("治疗用抗血清");
CType.addItem("诊断制剂");
CType.addItem("微生态制剂");
CType.setBounds(120, 115, 200, 25);
CType.setFont(new Font(null,Font.BOLD,14));
this.add(CType);
TAttention=new JTextField(50); //设置文本:注意事项
TAttention.setBounds(120, 155, 230, 25);
TAttention.setFont(new Font(null,Font.BOLD,14));
this.add(TAttention);
BSure=new JButton("确定");
BSure.setBounds(80,200,60,25);
this.add(BSure);
BSure.addActionListener(new ActionListener(){ //确定按钮监听器
public void actionPerformed(ActionEvent arg0) {
new NewBacteriaGet(NewBacteria.this);
}
});
BCancel=new JButton("取消");
BCancel.setBounds(200,200,60,25);
this.add(BCancel);
BCancel.addActionListener(new ActionListener(){ //取消按钮监听器
public void actionPerformed(ActionEvent arg0) {
NewBacteria.this.dispose();
new BacteriaRegister();
}
});
this.setVisible(true); //设置窗体可视化
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -