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

📄 checkwindow.java

📁 图书馆的图书管理系统! 图书查询
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package labraryManager;
import javax.swing.*;

import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.border.*;

import java.util.Vector;
public class CheckWindow extends JFrame implements ActionListener{
    public static final int WIDTH=500;
    public static final int HEIGHT=300;
    Vector v2=new Vector(),v3=new Vector();
    
    JTextField t1;
    JTextField t2;
    JTextField f;
    JTextField f2;
    JTextField f3;
    JTextField f4;
    String s;
    JComboBox combo1;
    JComboBox combo12;
    JComboBox combo13;
    JComboBox combo14;
    
    JComboBox combo3;
    JComboBox combo32;
    JComboBox combo33;
    JComboBox combo34;
    
    String[] string1={"BookID","BookName","Author","Publisher","BookPrice","Abstract","Class","BookStatus"};
    String[] string2={"ReaderID","Name","Level","Address","TelephoneNumber","Email"};
    public CheckWindow(){
    	setSize(WIDTH,HEIGHT);
    	setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    	addWindowListener(new WindowDestroyer());
    	setTitle("图书管理系统");
    	Container x=getContentPane();
    	
    	x.setLayout(new BorderLayout());
    	
    	JTabbedPane tab=new JTabbedPane();
    	x.add(tab);
    	
    	
    	
    	JPanel s=new JPanel();
    	
    	s.setLayout(new BorderLayout());
    	
    	JPanel m5=new JPanel();
    	
    	m5.setLayout(new GridLayout(4,1));
    	
    	JPanel m1=new JPanel();
    	
    	m1.setLayout(new FlowLayout());
    	
    	String[] books={"书名","作者名","书号","出版社","关键字","类别"};
    	combo1=new JComboBox(books);
    	String[] relation1={"并且","或者","非"};
    	JComboBox combo2=new JComboBox(relation1);
    	String[] relation2={"任意一致","后方一致","前方一致","等于"};
    	combo3=new JComboBox(relation2);
    	 f=new JTextField(20);
    	m1.add(combo1);
    	m1.add(f);
    	m1.add(combo2);
    	m1.add(combo3);
    	
    	JPanel m2=new JPanel();
    	
    	m2.setLayout(new FlowLayout());
    	String[] books2={"书名","作者名","书号","出版社","关键字","类别"};
    	combo12=new JComboBox(books2);
    	String[] relation12={"并且","或者","非"};
    	JComboBox combo22=new JComboBox(relation12);
    	String[] relation22={"任意一致","后方一致","前方一致","等于"};
    	 combo32=new JComboBox(relation22);
    	 f2=new JTextField(20);
    	m2.add(combo12);
    	m2.add(f2);
    	m2.add(combo22);
    	m2.add(combo32);
    	
    	JPanel m3=new JPanel();
    	
    	m3.setLayout(new FlowLayout());
    	String[] books3={"书名","作者名","书号","出版社","关键字","类别"};
    	combo13=new JComboBox(books3);
    	String[] relation13={"并且","或者","非"};
    	JComboBox combo23=new JComboBox(relation13);
    	String[] relation23={"任意一致","后方一致","前方一致","等于"};
    	 combo33=new JComboBox(relation23);
    	 f3=new JTextField(20);
    	m3.add(combo13);
    	m3.add(f3);
    	m3.add(combo23);
    	m3.add(combo33);
    	
    	JPanel m4=new JPanel();
    	
    	m4.setLayout(new FlowLayout());
    	String[] books4={"书名","作者名","书号","出版社","关键字","类别"};
    	combo14=new JComboBox(books4);
    	String[] relation14={"并且","或者","非"};
    	JComboBox combo24=new JComboBox(relation14);
    	String[] relation24={"任意一致","后方一致","前方一致","等于"};
    	 combo34=new JComboBox(relation24);
    	 f4=new JTextField(20);
    	m4.add(combo14);
    	m4.add(f4);
    	m4.add(combo24);
    	m4.add(combo34);
    	
    	m5.add(m1);
    	m5.add(m2);
    	m5.add(m3);
    	m5.add(m4);
    	
    	s.add(m5,BorderLayout.CENTER);
    	
    	JPanel m=new JPanel();
    	
    	m.setLayout(new FlowLayout());
    	JButton n1=new JButton("搜索");
    	
    	n1.addActionListener(this);
    	m.add(n1);
    	JButton n2=new JButton("清除");
    	
    	n2.addActionListener(this);
    	m.add(n2);
    	JButton n3=new JButton("返回主界面");
    	
    	n3.addActionListener(this);
    	m.add(n3);
    	JButton n4=new JButton("退出");
    	
    	n4.addActionListener(this);
    	m.add(n4);
    	
    	s.add(m,BorderLayout.SOUTH);
    	
    	tab.add("图书查询",s);
    	
    	JPanel d=new JPanel();
    	
    	d.setLayout(new BorderLayout());
    	
    	JLabel z1=new JLabel("读者ID号");
        t1=new JTextField(20);
    	//t1.setEditable(true);
    	JPanel h1=new JPanel();
    	
    	h1.setLayout(new FlowLayout());
    	h1.add(z1);h1.add(t1);
    	
    	JPanel h2=new JPanel();
        JLabel z2=new JLabel("读者姓名");
    	t2=new JTextField(20);
    	
    	//JScrollPane st=new JScrollPane(t2);
    	//st.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    	//st.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    	
    	h2.setLayout(new FlowLayout());
    	h2.add(z2);
    	h2.add(t2);
    	
    	JPanel button=new JPanel();
    	
    	button.setLayout(new FlowLayout());
        
    	JButton b33=new JButton("确定");
    	b33.addActionListener(this);
    	button.add(b33);
    	
    	JButton b11=new JButton("返回主界面");
    	b11.addActionListener(this);
    	button.add(b11);
    	
    	JButton b22=new JButton("退出");
    	b22.addActionListener(this);
    	button.add(b22);
    	
    	d.add(h1,BorderLayout.NORTH);
    	d.add(h2,BorderLayout.CENTER);
    	
    	d.add(button,BorderLayout.SOUTH);
    	tab.add("读者查询",d);
    	
    	JPanel b=new JPanel();
    	
    	b.setLayout(new BorderLayout());
    	
    	JLabel z=new JLabel("本版本支持多关键字查询和模糊查询");
    	z.setBorder(new EmptyBorder(10,150,10,10));
    	//Font a=new Font("隶书",Font.PLAIN,50);
    	//z.setFont(a);
    	b.add(z,BorderLayout.CENTER);
    	
    	tab.add("帮助",b);	
    	
    	
    }
    public String getCommand(String s)
    {
    	String x=null;
    	if(s.equals("书名"))x="BookName";
    	else if(s.equals("作者名"))x="Author";
    	else if(s.equals("书号"))x="BookID";
    	else if(s.equals("出版社"))x="Publisher";
    	else if(s.equals("类别"))x="Class";
    	return x;
    }
    public String getFrontCommand(String s){
    	String x=null;
    	if(s.equals("任意一致"))x=" like '%";
    	else if(s.equals("后方一致"))x=" like '%";
    	else if(s.equals("前方一致"))x=" like '";
    	else if(s.equals("等于"))x="='";
    	
    	return x;
    	
    }
    public String getBackCommand(String s){
    	String x=null;
    	if(s.equals("任意一致"))x="%'";

⌨️ 快捷键说明

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