📄 adminquery.java
字号:
package admin.services.frame;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import string.logic.GetCustomer;
import DBManager.SQLserver2000;
import MainFrame.MainFrame;
import MainFrame.MyFrame;
import customer.po.MoneyLog;
import customer.services.action.CustomerAction;
public class AdminQuery extends MyFrame implements ActionListener {
/**
*
*/
private static final long serialVersionUID = 1L;
private JLabel username;
private JLabel money;
private JLabel moneyLog;
private JLabel moneyState;
private JLabel moneyDate;
private JTextField input;
private JButton search;
private JButton ok;
public AdminQuery(MainFrame m) {
super(m);
initialize(m.getTitle());
}
private void initialize(String title) {
String IDcard = new GetCustomer().getIDcard(title);
String result = new CustomerAction().getBalance(IDcard);//余额查询
username = new JLabel();
username.setText("输入你要查询的身份证号:");
username.setFont(new Font("黑体",Font.BOLD,20));
username.setBounds(new Rectangle(5, 5, 400, 100));
input = new JTextField();
input.setText(IDcard);
input.setBounds(new Rectangle(245, 45, 150, 27));
search = new JButton();
search.setText("提交查询");
search.setFont(new Font("黑体",Font.BOLD,15));
search.setBounds(new Rectangle(405, 45, 100, 30));
search.addActionListener(this);
moneyLog = new JLabel();
moneyLog.setText("以下是你的操作历史记录:");
moneyLog.setFont(new Font("黑体",Font.BOLD,20));
//moneyLog.setForeground(Color.red);
moneyLog.setBounds(new Rectangle(15, 35, 280, 100));
moneyState = new JLabel();
moneyState.setText("操作状态:");
moneyState.setFont(new Font("黑体",Font.BOLD,17));
moneyState.setForeground(Color.red);
moneyState.setBounds(new Rectangle(15, 55, 200, 100));
moneyDate = new JLabel();
moneyDate.setText("操作时间:");
moneyDate.setFont(new Font("黑体",Font.BOLD,17));
moneyDate.setForeground(Color.red);
moneyDate.setBounds(new Rectangle(215, 55, 200, 100));
// money = new JLabel();
// money.setText("余额:"+result);
// money.setFont(new Font("黑体",Font.BOLD,20));
// money.setBounds(new Rectangle(315, 5, 200, 100));
this.initMoneyLog(IDcard);
ok = new JButton();
ok.setText("返回上一级");
//ok.setFont(new Font("黑体",Font.BOLD,20));
ok.setBounds(new Rectangle(380, 335, 100, 30));
ok.addActionListener(this);
this.add(username);
this.add(input);
// this.add(money);
this.add(moneyLog);
this.add(moneyState);
this.add(moneyDate);
this.add(search);
this.add(ok);
this.setTitle(title);
this.setBounds(300,200,520,390);
}
public static void main(String[] args) {
}
public void initMoneyLog(String IDcard){
List<MoneyLog> MoneyLog = new CustomerAction().getMoneyLog(IDcard);
if(MoneyLog.size()==0){
JOptionPane.showMessageDialog(this, "无此人记录");
input.selectAll();
return ;
}
int up = 115 , down = 75 , left = 100 ,right =100;
if(MoneyLog.size()!=0&&MoneyLog.size()<20){
for(int i =0;i<MoneyLog.size();i++){
JLabel JL = new JLabel();
JL.setText(MoneyLog.get(i).getMoneyLog());
JL.setBounds(new Rectangle(up, down, left, right));
JLabel JLM = new JLabel();
JLM.setText(MoneyLog.get(i).getLogDate());
JLM.setBounds(new Rectangle(up+200, down, left+100, right));
this.add(JL);
this.add(JLM);
down+=15;
}
}
System.out.println(MoneyLog.size()+"---MoneyLog.size()");
}
public void Paint(String star , String end ){
}
public void actionPerformed(ActionEvent e) {
if(e.getSource() == search){
String IDcard = input.getText();
this.removeAll();
this.initialize("身份证号:"+IDcard);
this.setVisible(false);
this.setVisible(true);
//this.initMoneyLog(IDcard);
}else{
if(m!=null)
m.setVisible(true);
dispose();
SQLserver2000.closeDB();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -