📄 chargeregister.java
字号:
package yd.pethospital.chargeregister.view;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import yd.pethospital.chargecommon.*;
public class ChargeRegister {
public static JFrame frame;
public static JTable BTCK; //表格
public static JButton BAdd,BDel, BBack; //增加 删除 返回 按钮
public static int Mess;
JLabel LTitle; //标题 标签
public ChargeRegister(){
frame=new JFrame(); //设置窗体
frame.setTitle("收费登记"); //位置 大小 不可改变大小 空布局 标题
frame.setBounds(180, 100, 740, 500);
frame.setResizable(false);
frame.setLayout(null);
frame.validate();
LTitle=new JLabel("收费登记"); //设置标题标签
LTitle.setFont(new Font(null,Font.TYPE1_FONT,28));
LTitle.setBounds(330,15,120,40);
RegisterGet Reget=new RegisterGet();
BTCK=new JTable(Reget); //创建 设置表格
JScrollPane JSPane=new JScrollPane(BTCK);
JSPane.setBounds(80,50,600,360);
BTCK.setVisible(true);
BTCK.addMouseListener(new MouseListener(){ //添加表格的监听器
public void mouseClicked(MouseEvent e) {
if(e.getClickCount()==2){ //双击表格事件
new ChangeCharge();
ChangeChargeGet.GetText();
frame.dispose();
}
}
public void mouseEntered(MouseEvent arg0) {}
public void mouseExited(MouseEvent arg0) {}
public void mousePressed(MouseEvent arg0) {}
public void mouseReleased(MouseEvent arg0) {}
});
BAdd=new JButton("新增");
BDel=new JButton("删除");
BBack=new JButton("返回");
BAdd.setBounds(160,420,70,30);
BAdd.setFont(new Font(null,Font.BOLD,14));
BDel.setBounds(320,420,70,30);
BDel.setFont(new Font(null,Font.BOLD,14));
BBack.setBounds(480,420,70,30);
BBack.setFont(new Font(null,Font.BOLD,14));
frame.add(BAdd);
frame.add(BDel);
frame.add(BBack);
BAdd.addActionListener(new ActionListener(){ //添加新增按钮 监听器
public void actionPerformed(ActionEvent arg0) {
new NewCharge();
frame.dispose();
}
});
BBack.addActionListener(new ActionListener(){ //添加删除按钮 监听器
public void actionPerformed(ActionEvent arg0) {
frame.dispose();
}
});
BDel.addActionListener(new ActionListener(){ //添加返回 监听器
public void actionPerformed(ActionEvent arg0) {
Mess=JOptionPane.showConfirmDialog(null, "确认是否删除所选信息?", "系统信息提示", JOptionPane.YES_NO_OPTION);
if(Mess==JOptionPane.YES_OPTION){
new DeleteCharge();
}
}
});
JSPane.setBounds(80,50,600,360);
frame.add(LTitle);
frame.add(JSPane);
frame.setVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -