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

📄 queryframe.java

📁 简单的书店管理系统,是课设期间教师指导完成的,希望会对大家有帮助!
💻 JAVA
字号:
package book;
//综合查询
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JScrollPane;

public class QueryFrame extends Mb{
	
	private JLabel icon,label;
	
	private ButtonIcon reader,book,jieBook,huanBook,weiBook,chaoBook,faReader;
	
    private NowEditableModel dtm;
	
	private JScrollPane scrool;
	
	private Table table;
	QueryFrame(String s, int i, int j) throws SQLException{
		super(s, i, j);
		con.setLayout(null);	
		shezhi();
		add();
	
	}

	void shezhi() throws SQLException{
		
		icon=new JLabel(new ImageIcon("./data/image/heard/zonghechaxun.jpg"));
		icon.setBounds(10,5,690,50);
		
		
		MainDAO dao = new MainDAO();
		dtm = (NowEditableModel) dao.getTableModel("select * from duzheziliao");
		table = new Table(dtm);
		scrool = new JScrollPane(table);
		scrool.setBounds(20, 120, 670, 400);
		table.setWidth();
		setButton();
	}
	
	
	
	void setButton(){
		
		Font fo=new Font("",Font.BOLD,18);
		label=new JLabel("现有的所有读者");
		label.setFont(fo);
		label.setBounds(280,90,300,25);
		
		reader=new ButtonIcon("所有读者");
		reader.setBounds(20,60,70,25);
		reader.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent arg0) {
				try {
					table.Renovate("select * from duzheziliao");
					label.setText("现有的所有读者");
				} catch (SQLException e) {
				}
			}
			
		});
		
		
		book=new ButtonIcon("所有图书");
		book.setBounds(120,60,70,25);
		book.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent arg0) {
				try {
					table.Renovate("select * from tushuziliao");
					label.setText("现存库的所有图书");
				} catch (SQLException e) {
				}
				
			}
			
		});
		
		jieBook=new ButtonIcon("借书记录");
		jieBook.setBounds(220,60,70,25);
		jieBook.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent arg0) {
				try {
					table.Renovate("select * from jiechutushu");
					label.setText("借出图书记录");
				} catch (SQLException e) {
				}
				
			}
			
		});
		
		
		huanBook=new ButtonIcon("还书记录");
		huanBook.setBounds(320,60,70,25);
		huanBook.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent arg0) {
				try {
					table.Renovate("select * from huanshujilu");
					label.setText("已还图书记录");
				} catch (SQLException e) {
				}
				
			}
			
		});
		
		
		weiBook=new ButtonIcon("未还图书");
		weiBook.setBounds(420,60,70,25);
		weiBook.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent arg0) {
				try {
					table.Renovate("select * from tushuziliao where 是否借出='是'");
					label.setText("所有未还图书");
				} catch (SQLException e) {
				}
				
			}
			
		});
		
		
		chaoBook=new ButtonIcon("超期未还");
		chaoBook.setBounds(520,60,70,25);
		chaoBook.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent arg0) {
				try {
					MainDAO dao=new MainDAO();
	                  dao.getCtimeBook();//刷新所有超期图书
	                  table.Renovate("select * from jiechutushu where 是否超期='是'");
	                  label.setText("所有超期图书");
					}
					 catch (SQLException e) {
				}
				
			}
			
		});
		
		
		faReader=new ButtonIcon("已还未罚");
		faReader.setBounds(620,60,70,25);
		faReader.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent arg0) {
				try {
					table.Renovate("select * from fakuanbiao where 是否已罚='未处罚'");
					label.setText("已经还书但是没有罚款的图书");
				} catch (SQLException e) {
				}
				
			}
			
		});

	}
	
	
	void add(){
		con.add(reader);
		con.add(book);
		con.add(jieBook);
		con.add(huanBook);
		con.add(weiBook);
		con.add(chaoBook);
		con.add(faReader);
		con.add(scrool);
		con.add(label);
		con.add(icon);
	}
}

⌨️ 快捷键说明

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